mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-23 14:55:44 +00:00
chore: implement delete error message toast
This commit is contained in:
@@ -25,7 +25,7 @@ import RequirePermission from '@/components/helper/RequirePermission';
|
||||
import { Nonstock } from '@/types/api/master-data/nonstock';
|
||||
import { NonstockApi } from '@/services/api/master-data';
|
||||
import { cn } from '@/lib/helper';
|
||||
import { isResponseSuccess } from '@/lib/api-helper';
|
||||
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
||||
import { useTableFilter } from '@/services/hooks/useTableFilter';
|
||||
import { ROWS_OPTIONS } from '@/config/constant';
|
||||
|
||||
@@ -198,7 +198,16 @@ const NonstocksTable = () => {
|
||||
const confirmationModalDeleteClickHandler = async () => {
|
||||
setIsDeleteLoading(true);
|
||||
|
||||
await NonstockApi.delete(selectedNonstock?.id as number);
|
||||
const deleteResponse = await NonstockApi.delete(
|
||||
selectedNonstock?.id as number
|
||||
);
|
||||
|
||||
if (isResponseError(deleteResponse)) {
|
||||
toast.error(deleteResponse.message);
|
||||
setIsDeleteLoading(false);
|
||||
return;
|
||||
}
|
||||
|
||||
refreshNonstocks();
|
||||
|
||||
deleteModal.closeModal();
|
||||
|
||||
Reference in New Issue
Block a user