Merge branch 'feature/notify-via-SMS' of https://github.com/bigcapitalhq/client into feature/notify-via-SMS

This commit is contained in:
a.bouhuolia
2021-11-09 09:56:53 +02:00
13 changed files with 115 additions and 36 deletions

View File

@@ -2,13 +2,21 @@ import { Intent } from '@blueprintjs/core';
import { AppToaster } from 'components';
import intl from 'react-intl-universal';
export const transformErrors = (errors) => {
export const transformErrors = (errors, { setErrors }) => {
if (errors.some((e) => e.type === 'CUSTOMER_SMS_NOTIFY_PHONE_INVALID')) {
AppToaster.show({
message: intl.get('notify_via_sms.dialog.error_message'),
intent: Intent.DANGER,
});
}
if (errors.find((error) => error.type === 'CUSTOMER_HAS_NO_PHONE_NUMBER')) {
setErrors({
customer_phone_number: intl.get(
'notify_via_sms.dialog.customer_no_phone_error_message',
),
});
}
};