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