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