下面是我的axios请求,其中我将时间戳添加到了URL。我做错了吗?因为我要获取旧数据(更新文档之前的数据)
axios.get(`${url}?timestamp=${new Date().getTime()}`)
router.get('/:uid', (req, res) => {User.findOne({ uid: req.params.uid})}
// editPost组件
class EditUserDetails extends React.Component{
constructor(props){
super(props);
}
render(){
return(
<div className="editUser">
{console.log(this.props.currentUser)}
<UserForm
user={this.props.currentUser}
onSubmit={ (updates) => {
console.log(updates);
this.props.dispatch(editUser(this.props.currentUser.uid, updates));
this.props.history.push(`/user/${this.props.currentUser.uid}`);
}} />
</div>
)
}
}