mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-22 07:40:32 +00:00
fix (Invite user): catch message error.
This commit is contained in:
@@ -55,7 +55,13 @@ function InviteUserForm({
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Handle the response error.
|
// Handle the response error.
|
||||||
const onError = (errors) => {
|
const onError = (error) => {
|
||||||
|
const {
|
||||||
|
response: {
|
||||||
|
data: { errors },
|
||||||
|
},
|
||||||
|
} = error;
|
||||||
|
|
||||||
const errorsTransformed = transformApiErrors(errors);
|
const errorsTransformed = transformApiErrors(errors);
|
||||||
|
|
||||||
setErrors({ ...errorsTransformed });
|
setErrors({ ...errorsTransformed });
|
||||||
|
|||||||
@@ -6,5 +6,8 @@ export const transformApiErrors = (errors) => {
|
|||||||
if (errors.find((error) => error.type === 'EMAIL.ALREADY.INVITED')) {
|
if (errors.find((error) => error.type === 'EMAIL.ALREADY.INVITED')) {
|
||||||
fields.email = formatMessage({ id: 'email_is_already_used' });
|
fields.email = formatMessage({ id: 'email_is_already_used' });
|
||||||
}
|
}
|
||||||
|
if (errors.find((error) => error.type === 'EMAIL.ALREADY.EXISTS')) {
|
||||||
|
fields.email = formatMessage({ id: 'email_is_already_used' });
|
||||||
|
}
|
||||||
return fields;
|
return fields;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user