Update UsersList.js

show toast after creating user and refresh the list after delete
This commit is contained in:
Ash Monsh 2023-04-23 05:43:09 +03:00
parent 5027d9d945
commit 8bc0fb92ba

View File

@ -18,10 +18,15 @@ export function UsersList() {
const { toast, showToast } = useToast();
const hasData = data && data.length !== 0;
const handleSave = () => refetch();
const handleSave = () => {
refetch().then(() => showToast({ message: formatMessage(messages.saved), variant: 'success' }));
};
const handleDelete = () =>
showToast({ message: formatMessage(messages.userDeleted), variant: 'success' });
const handleDelete = () => {
refetch().then(() =>
showToast({ message: formatMessage(messages.userDeleted), variant: 'success' }),
);
};
return (
<Page loading={isLoading} error={error}>