mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
fix: refactor confirmationModalDeleteClickHandler function
This commit is contained in:
@@ -31,7 +31,7 @@ import RequirePermission from '@/components/helper/RequirePermission';
|
||||
import { TransferToLaying } from '@/types/api/production/transfer-to-laying';
|
||||
import { TransferToLayingApi } from '@/services/api/production/transfer-to-laying';
|
||||
import { cn, formatDate } 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';
|
||||
import { Flock } from '@/types/api/master-data/flock';
|
||||
@@ -397,17 +397,21 @@ const TransferToLayingsTable = () => {
|
||||
const confirmationModalDeleteClickHandler = async () => {
|
||||
setIsDeleteLoading(true);
|
||||
|
||||
try {
|
||||
await TransferToLayingApi.delete(selectedTransferToLaying?.id as number);
|
||||
const deleteResponse = await TransferToLayingApi.delete(
|
||||
selectedTransferToLaying?.id as number
|
||||
);
|
||||
|
||||
toast.success('Berhasil menghapus data transfer ke laying!');
|
||||
refreshTransferToLayings();
|
||||
} catch (error) {
|
||||
toast.success('Gagal menghapus data transfer ke laying!');
|
||||
} finally {
|
||||
deleteModal.closeModal();
|
||||
if (isResponseError(deleteResponse)) {
|
||||
toast.error(deleteResponse.message);
|
||||
setIsDeleteLoading(false);
|
||||
return;
|
||||
}
|
||||
|
||||
refreshTransferToLayings();
|
||||
|
||||
deleteModal.closeModal();
|
||||
toast.success('Berhasil menghapus data transfer ke laying!');
|
||||
setIsDeleteLoading(false);
|
||||
};
|
||||
|
||||
const confirmationModalApproveClickHandler = async (notes: string) => {
|
||||
|
||||
Reference in New Issue
Block a user