feat: handle error.

This commit is contained in:
elforjani13
2021-11-08 13:20:49 +02:00
parent 4d89f1e0e0
commit 6d67d6163d
8 changed files with 56 additions and 9 deletions

View File

@@ -6,6 +6,7 @@ import { AppToaster } from 'components';
import NotifyViaSMSForm from '../../NotifyViaSMS/NotifyViaSMSForm';
import { useNotifyPaymentReceiveViaSMSContext } from './NotifyPaymentReceiveViaFormProvider';
import { transformErrors } from '../../../containers/NotifyViaSMS/utils';
import withDialogActions from 'containers/Dialog/withDialogActions';
import { compose } from 'utils';
@@ -38,8 +39,12 @@ function NotifyPaymentReceiveViaSMSForm({
};
// Handle request response errors.
const onError = ({}) => {
setSubmitting(false);
const onError = ({
response: {
data: { errors },
},
}) => {
transformErrors(errors);
};
createNotifyPaymentReceivetBySMSMutate([paymentReceiveId, values])
.then(onSuccess)