This commit is contained in:
a.bouhuolia
2021-04-06 18:59:07 +02:00
3 changed files with 11 additions and 1 deletions

View File

@@ -55,7 +55,13 @@ function InviteUserForm({
};
// Handle the response error.
const onError = (errors) => {
const onError = (error) => {
const {
response: {
data: { errors },
},
} = error;
const errorsTransformed = transformApiErrors(errors);
setErrors({ ...errorsTransformed });

View File

@@ -6,5 +6,8 @@ export const transformApiErrors = (errors) => {
if (errors.find((error) => error.type === 'EMAIL.ALREADY.INVITED')) {
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;
};

View File

@@ -81,6 +81,7 @@ export default function ReceiptFormFloatingActions() {
<ButtonGroup>
<Button
disabled={isSubmitting}
loading={isSubmitting}
intent={Intent.PRIMARY}
onClick={handleSubmitCloseBtnClick}
text={<T id={'save_close'} />}