replace notistack

This commit is contained in:
Proddy
2023-03-10 20:28:43 +01:00
parent ae890dab37
commit 8cbae88dc3
22 changed files with 129 additions and 172 deletions

View File

@@ -14,7 +14,7 @@ import {
import CloseIcon from '@mui/icons-material/Close';
import { extractErrorMessage } from 'utils';
import { useSnackbar } from 'notistack';
import { toast } from 'react-toastify';
import { MessageBox } from 'components';
import * as SecurityApi from 'api/security';
import { Token } from 'types';
@@ -32,15 +32,13 @@ const GenerateToken: FC<GenerateTokenProps> = ({ username, onClose }) => {
const { LL } = useI18nContext();
const { enqueueSnackbar } = useSnackbar();
const getToken = useCallback(async () => {
try {
setToken((await SecurityApi.generateToken(username)).data);
} catch (error) {
enqueueSnackbar(extractErrorMessage(error, LL.PROBLEM_UPDATING()), { variant: 'error' });
toast.error(extractErrorMessage(error, LL.PROBLEM_UPDATING()));
}
}, [username, enqueueSnackbar, LL]);
}, [username, LL]);
useEffect(() => {
if (open) {