feat: added 422 handle error on update email

This commit is contained in:
Sergey Yarkov 2021-09-13 18:36:48 +03:00
parent 248e57e548
commit 79b82d317b

View File

@ -41,7 +41,8 @@ const useUpdateUserEmailQuery = () => {
}
if (error.response) {
if (error.response.status === 503) {
const status = error.response.status;
if (status === 503) {
switch (error.response.data.code) {
case 'E_CONFIRM_CODE_EXIST':
toast({ title: 'Please, try send code later.', status: 'info' });
@ -50,6 +51,8 @@ const useUpdateUserEmailQuery = () => {
toast({ title: `Unable to send confirmation code, try again later.`, status: 'error' });
break;
}
} else if (status === 422) {
toast({ title: error.response.data.errors[0].message, status: 'error' });
} else {
handleError(error);
}