try const response await fetch http localhost 4040 api account signup

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
try {
const response = await fetch('http://localhost:4040/api/account/signup', {
method: 'POST',
body: form_data,
});
const json = await response.json();
if (json.accessToken) {
Auth.setToken(json.accessToken);
this.context.loginHandler(true);
this.props.history.push('/');
return true;
} else {
for(var k in json.errors) {
actions.setFieldError("login", json.errors[k]);
}
actions.setSubmitting(false);
}
} catch(e) {
}