feat(auth): add feedback state for user and role management (#1191)
This commit is contained in:
@@ -2,6 +2,7 @@ import * as React from 'react';
|
||||
import { useMutation } from '@apollo/client';
|
||||
import IconButton from '@mui/material/IconButton';
|
||||
import DeleteIcon from '@mui/icons-material/Delete';
|
||||
import { useSnackbar } from 'notistack';
|
||||
|
||||
import ConfirmationDialog from 'components/ConfirmationDialog';
|
||||
import { DELETE_USER } from 'graphql/mutations/delete-user.ee';
|
||||
@@ -9,7 +10,7 @@ import useFormatMessage from 'hooks/useFormatMessage';
|
||||
|
||||
type DeleteUserButtonProps = {
|
||||
userId: string;
|
||||
}
|
||||
};
|
||||
|
||||
export default function DeleteUserButton(props: DeleteUserButtonProps) {
|
||||
const { userId } = props;
|
||||
@@ -19,11 +20,19 @@ export default function DeleteUserButton(props: DeleteUserButtonProps) {
|
||||
refetchQueries: ['GetUsers'],
|
||||
});
|
||||
const formatMessage = useFormatMessage();
|
||||
const { enqueueSnackbar } = useSnackbar();
|
||||
|
||||
const handleConfirm = React.useCallback(async () => {
|
||||
await deleteUser();
|
||||
try {
|
||||
await deleteUser();
|
||||
|
||||
setShowConfirmation(false);
|
||||
setShowConfirmation(false);
|
||||
enqueueSnackbar(formatMessage('deleteUserButton.successfullyDeleted'), {
|
||||
variant: 'success',
|
||||
});
|
||||
} catch (error) {
|
||||
throw new Error('Failed while deleting!');
|
||||
}
|
||||
}, [deleteUser]);
|
||||
|
||||
return (
|
||||
|
Reference in New Issue
Block a user