Trying delete without hit api on Transfertype

This commit is contained in:
bagusajisaputroo
2025-04-10 21:15:29 +07:00
parent 5a89a80d97
commit 1bfe3d47ff

View File

@ -19,7 +19,9 @@ const DeleteDialog = () => {
message: '' message: ''
}); });
const doDeleteTransferType = useCallback(async () => {
const doDeleteTransferType = useCallback(async (id:string) => {
if (!selectedTransferType) { if (!selectedTransferType) {
toast.error('No Transfer Type selected'); toast.error('No Transfer Type selected');
return; return;
@ -40,6 +42,11 @@ const DeleteDialog = () => {
// setTimeout(() => toast.error('Failed Delete Product'), 0); // setTimeout(() => toast.error('Failed Delete Product'), 0);
} }
}, [selectedTransferType, DeleteData, handleDeleteDialog, reload]); }, [selectedTransferType, DeleteData, handleDeleteDialog, reload]);
const handleDelete = ((id:string) => {
console.log(id);
// doDeleteTransferType(id);
})
return ( return (
<Dialog open={showDeleteDialog} onOpenChange={(open) => handleDeleteDialog(open, null)}> <Dialog open={showDeleteDialog} onOpenChange={(open) => handleDeleteDialog(open, null)}>
<DialogContent className="container-fixed max-w-md flex flex-col p-5 overflow-hidden [&>button]:hidden"> <DialogContent className="container-fixed max-w-md flex flex-col p-5 overflow-hidden [&>button]:hidden">
@ -60,7 +67,7 @@ const DeleteDialog = () => {
<Button variant={'outline'} onClick={() => handleDeleteDialog(false, null)}> <Button variant={'outline'} onClick={() => handleDeleteDialog(false, null)}>
Cancel Cancel
</Button> </Button>
<Button variant={'destructive'} onClick={() => doDeleteTransferType()}> <Button variant={'destructive'} onClick={() => handleDelete(selectedTransferType)}>
Delete Delete
</Button> </Button>
</DialogFooter> </DialogFooter>