mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 21:00:31 +00:00
feat: handle error.
This commit is contained in:
@@ -6,6 +6,7 @@ import { AppToaster } from 'components';
|
||||
|
||||
import NotifyViaSMSForm from '../../NotifyViaSMS/NotifyViaSMSForm';
|
||||
import { useEstimateViaSMSContext } from './NotifyEstimateViaSMSFormProvider';
|
||||
import { transformErrors } from '../../../containers/NotifyViaSMS/utils';
|
||||
|
||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||
import { compose } from 'utils';
|
||||
@@ -33,8 +34,12 @@ function NotifyEstimateViaSMSForm({
|
||||
};
|
||||
|
||||
// Handle request response errors.
|
||||
const onError = () => {
|
||||
setSubmitting(false);
|
||||
const onError = ({
|
||||
response: {
|
||||
data: { errors },
|
||||
},
|
||||
}) => {
|
||||
transformErrors(errors);
|
||||
};
|
||||
createNotifyEstimateBySMSMutate([estimateId, values])
|
||||
.then(onSuccess)
|
||||
|
||||
@@ -6,6 +6,7 @@ import { AppToaster } from 'components';
|
||||
|
||||
import NotifyViaSMSForm from '../../NotifyViaSMS/NotifyViaSMSForm';
|
||||
import { useNotifyInvoiceViaSMSContext } from './NotifyInvoiceViaSMSFormProvider';
|
||||
import { transformErrors } from '../../../containers/NotifyViaSMS/utils';
|
||||
|
||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||
import { compose } from 'utils';
|
||||
@@ -41,7 +42,7 @@ function NotifyInvoiceViaSMSForm({
|
||||
data: { errors },
|
||||
},
|
||||
}) => {
|
||||
setSubmitting(false);
|
||||
transformErrors(errors);
|
||||
};
|
||||
createNotifyInvoiceBySMSMutate([invoiceId, values])
|
||||
.then(onSuccess)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -6,6 +6,7 @@ import { AppToaster } from 'components';
|
||||
|
||||
import NotifyViaSMSForm from '../../NotifyViaSMS/NotifyViaSMSForm';
|
||||
import { useNotifyReceiptViaSMSContext } from './NotifyReceiptViaSMSFormProvider';
|
||||
import { transformErrors } from '../../../containers/NotifyViaSMS/utils';
|
||||
|
||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||
import { compose } from 'utils';
|
||||
@@ -36,8 +37,12 @@ function NotifyReceiptViaSMSForm({
|
||||
};
|
||||
|
||||
// Handle request response errors.
|
||||
const onError = ({}) => {
|
||||
setSubmitting(false);
|
||||
const onError = ({
|
||||
response: {
|
||||
data: { errors },
|
||||
},
|
||||
}) => {
|
||||
transformErrors(errors);
|
||||
};
|
||||
createNotifyReceiptBySMSMutate([receiptId, values])
|
||||
.then(onSuccess)
|
||||
|
||||
Reference in New Issue
Block a user