Ea aliqua elit reprehenderit pariatur consequat voluptate quis.
diff --git a/src/containers/Dialogs/EasySMSIntegrationDialog/EasySMSIntegrationForm.js b/src/containers/Dialogs/EasySMSIntegrationDialog/EasySMSIntegrationForm.js
index 4fcd66873..0342b26fb 100644
--- a/src/containers/Dialogs/EasySMSIntegrationDialog/EasySMSIntegrationForm.js
+++ b/src/containers/Dialogs/EasySMSIntegrationDialog/EasySMSIntegrationForm.js
@@ -8,6 +8,7 @@ import '../../../style/pages/EasySMSIntegration/EasySMSIntegration.scss';
import { AppToaster } from 'components';
import EasySMSIntegrationFormContent from './EasySMSIntegrationFormContent';
import { CreateEasySMSIntegrationSchema } from './EasySMSIntegrationForm.schema';
+import { useEasySMSIntegration } from './EasySMSIntegrationProvider';
import withDialogActions from 'containers/Dialog/withDialogActions';
import { compose } from 'utils';
@@ -23,13 +24,34 @@ function EasySMSIntegrationForm({
// #withDialogActions
closeDialog,
}) {
+ const { dialogName, easySMSIntegrateMutate } = useEasySMSIntegration();
+
// Initial form values.
const initialValues = {
...defaultInitialValues,
};
// Handles the form submit.
- const handleFormSubmit = (values, { setSubmitting, setErrors }) => {};
+ const handleFormSubmit = (values, { setSubmitting, setErrors }) => {
+ // Handle request response success.
+ const onSuccess = (response) => {
+ AppToaster.show({
+ message: intl.get('easysms.integrate.dialog.success_message'),
+ intent: Intent.SUCCESS,
+ });
+ closeDialog(dialogName);
+ };
+ // Handle request response errors.
+ const onError = ({
+ response: {
+ data: { errors },
+ },
+ }) => {
+ setSubmitting(false);
+ };
+
+ easySMSIntegrateMutate(values).then(onSuccess).catch(onError);
+ };
return (