https://dev.kronoz.win/r/marzneshin.git
| 1 |
857e289 |
Mrdn |
2y ago |
|
| 2 |
857e289 |
Mrdn |
2y ago |
import { DeleteConfirmation } from '@marzneshin/components' |
| 3 |
857e289 |
Mrdn |
2y ago |
import { FC } from 'react' |
| 4 |
857e289 |
Mrdn |
2y ago |
import { UserMutationType, useUsersDeletionMutation } from '@marzneshin/features/users' |
| 5 |
857e289 |
Mrdn |
2y ago |
|
| 6 |
857e289 |
Mrdn |
2y ago |
interface UsersDeleteConfirmationDialogProps { |
| 7 |
857e289 |
Mrdn |
2y ago |
onOpenChange: (state: boolean) => void |
| 8 |
857e289 |
Mrdn |
2y ago |
open: boolean |
| 9 |
857e289 |
Mrdn |
2y ago |
entity: UserMutationType | null |
| 10 |
857e289 |
Mrdn |
2y ago |
} |
| 11 |
857e289 |
Mrdn |
2y ago |
|
| 12 |
857e289 |
Mrdn |
2y ago |
export const UsersDeleteConfirmationDialog: FC<UsersDeleteConfirmationDialogProps> = ({ onOpenChange, open, entity }) => { |
| 13 |
857e289 |
Mrdn |
2y ago |
const deleteMutation = useUsersDeletionMutation(); |
| 14 |
857e289 |
Mrdn |
2y ago |
if (entity !== null) { |
| 15 |
857e289 |
Mrdn |
2y ago |
return ( |
| 16 |
857e289 |
Mrdn |
2y ago |
<DeleteConfirmation |
| 17 |
857e289 |
Mrdn |
2y ago |
open={open} |
| 18 |
857e289 |
Mrdn |
2y ago |
onOpenChange={onOpenChange} |
| 19 |
857e289 |
Mrdn |
2y ago |
action={() => deleteMutation.mutate(entity)} |
| 20 |
857e289 |
Mrdn |
2y ago |
/> |
| 21 |
857e289 |
Mrdn |
2y ago |
) |
| 22 |
857e289 |
Mrdn |
2y ago |
} |
| 23 |
857e289 |
Mrdn |
2y ago |
} |