← marzneshin
/
v0.6.3
/
dashboard/src/modules/services/components/dialogs/delete-confirmation.dialog.tsx
https://dev.kronoz.win/r/marzneshin.git
dashboard/src/modules/services/components/dialogs/delete-confirmation.dialog.tsx
· TypeScript
Blame
Raw
1
2import { DeleteConfirmation } from '@marzneshin/common/components'
3import { type FC, useEffect } from 'react'
4import { ServiceType, useServicesDeletionMutation } from '@marzneshin/modules/services'
5
6interface ServicesDeleteConfirmationDialogProps {
7 onOpenChange: (state: boolean) => void
8 open: boolean
9 entity: ServiceType
10 onClose: () => void;
11}
12
13export const ServicesDeleteConfirmationDialog: FC<ServicesDeleteConfirmationDialogProps> = ({ onOpenChange, open, entity, onClose }) => {
14 const deleteMutation = useServicesDeletionMutation();
15 useEffect(() => {
16 if (!open) onClose();
17 }, [open, onClose]);
18 return (
19 <DeleteConfirmation
20 open={open}
21 onOpenChange={onOpenChange}
22 action={() => deleteMutation.mutate(entity)}
23 />
24 )
25}