← marzneshin
/
v0.5.4
/
dashboard/src/features/admins/components/dialogs/delete-confirmation/index.tsx
https://dev.kronoz.win/r/marzneshin.git
dashboard/src/features/admins/components/dialogs/delete-confirmation/index.tsx
· TypeScript
Blame
Raw
1import { DeleteConfirmation } from "@marzneshin/components";
2import { type FC, useEffect } from "react";
3import {
4 type AdminType,
5 useAdminsDeletionMutation,
6} from "@marzneshin/features/admins";
7
8interface AdminsDeleteConfirmationDialogProps {
9 onOpenChange: (state: boolean) => void;
10 open: boolean;
11 entity: AdminType;
12 onClose: () => void;
13}
14
15export const AdminsDeleteConfirmationDialog: FC<
16 AdminsDeleteConfirmationDialogProps
17> = ({ onOpenChange, open, entity, onClose }) => {
18 const deleteMutation = useAdminsDeletionMutation();
19
20 useEffect(() => {
21 if (!open) onClose();
22 }, [open, onClose]);
23
24 return (
25 <DeleteConfirmation
26 open={open}
27 onOpenChange={onOpenChange}
28 action={() => deleteMutation.mutate(entity)}
29 />
30 );
31};