Answer the question
In order to leave comments, you need to log in
How to make friends server and react?
Wrote a simple server:
router.post('/login', async (ctx, next) => {
console.log(ctx.request.body.email);
console.log(ctx.request.body.password);
await next();
});
handleSubmit = e => {
e.preventDefault();
if (this.validateForm() == true) {
axios
.post('/api/login', {
params: {
email: this.state.email,
password: this.state.password
}
})
.then(response => {
console.log(response);
})
.catch(err => {
console.error(err);
});
} else {
alert('incorrect data');
}
}
proxy: {
'/api': {
target: 'http://localhost:5000'
},
},
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question