4 files changed
+31
-17
No files matched your search
+1
-2
@@ -10,7 +10,6 @@ import {
|
||||
Box,
|
||||
Tabs,
|
||||
Tab,
|
||||
CircularProgress
|
||||
} from "@mui/material";
|
||||
import { useTheme } from "@emotion/react";
|
||||
import TabPanel from "./TabPanel";
|
||||
@@ -311,7 +310,7 @@ const NotificationIntegrationModal = ({
|
||||
sx={{
|
||||
width: 'auto',
|
||||
minWidth: theme.spacing(60),
|
||||
px: theme.spacing(8)
|
||||
px: theme.spacing(8)
|
||||
}}
|
||||
>
|
||||
{t('commonSave')}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useState } from 'react';
|
||||
import { toast } from 'react-toastify';
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { networkService } from '../../../Utils/NetworkService';
|
||||
import { createToast } from '../../../Utils/toastUtils';
|
||||
|
||||
// Define constants for notification types to avoid magic values
|
||||
const NOTIFICATION_TYPES = {
|
||||
@@ -84,7 +84,10 @@ const useNotifications = () => {
|
||||
|
||||
// If validation fails, show error and return
|
||||
if (isValid === false) {
|
||||
toast.error(errorMessage);
|
||||
createToast({
|
||||
body: errorMessage,
|
||||
variant: "error"
|
||||
});
|
||||
setLoading(false);
|
||||
return;
|
||||
}
|
||||
@@ -96,13 +99,19 @@ const useNotifications = () => {
|
||||
});
|
||||
|
||||
if (response.data.success === true) {
|
||||
toast.success(t('notifications.testSuccess'));
|
||||
createToast({
|
||||
body: t('notifications.testSuccess'),
|
||||
variant: "info"
|
||||
});
|
||||
} else {
|
||||
throw new Error(response.data.msg || t('notifications.testFailed'));
|
||||
}
|
||||
} catch (error) {
|
||||
const errorMsg = error.response?.data?.msg || error.message || t('notifications.networkError');
|
||||
toast.error(`${t('notifications.testFailed')}: ${errorMsg}`);
|
||||
createToast({
|
||||
body: `${t('notifications.testFailed')}: ${errorMsg}`,
|
||||
variant: "error"
|
||||
});
|
||||
setError(errorMsg);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
|
||||
Reference in new issue
Block a user