Two arguments .thenare only successful and callbacks. You can also write it as.then(res => {}).catch(rej => {})
, await .then. , , , await. try/catch.
return async () => {
try {
const res = await axios.post('/api/signup', values);
console.log('result', res);
}
catch (rej) {
console.log('rejection', rej);
}
}
, async Promise, .
async/await ( , , ). 1