1. After the login is successful, the data returned by the backend is sent to the data of fetch, and then how to use routing to jump to other components
2. If routing is not needed, can I use window.location.href to jump to the component
handleSubmit = (e) = > {
e.preventDefault();
// let history = this.context.router.history;
this.props.form.validateFields((err, values) => {
if (!err) {
fetch("/api/login",{
method:"POST",
headers: {
"Accept": "application/json",
"Content-Type":"application/json;charset=UTF-8"
},
body:JSON.stringify({"email":values.email,"password":values.password}),
}).then(function (res) {
return res.json();
}).then(function(data){
console.log(data)
// window.location.href="/usercenter";
}
).catch(function (err) {
console.log(err);
})
}
});
}