gitscope
← marzneshin / v0.5.1 / dashboard/src/routes/_dashboard/hosts/$hostId/delete.tsx
https://dev.kronoz.win/r/marzneshin.git
dashboard/src/routes/_dashboard/hosts/$hostId/delete.tsx · TypeScript
Blame Raw
 1import {
 2    createFileRoute,
 3    useNavigate,
 4} from "@tanstack/react-router";
 5import {
 6    HostsDeleteConfirmationDialog,
 7    useRouterHostContext,
 8} from "@marzneshin/features/hosts";
 9import { useDialog } from "@marzneshin/hooks";
10
11const HostDelete = () => {
12    const [deleteDialogOpen, setDeleteDialogOpen] = useDialog(true);
13    const value = useRouterHostContext()
14    const navigate = useNavigate({ from: "/hosts/$hostId/delete" });
15
16    return value && (
17        <HostsDeleteConfirmationDialog
18            open={deleteDialogOpen}
19            onOpenChange={setDeleteDialogOpen}
20            entity={value.host}
21            onClose={() => navigate({ to: "/hosts" })}
22        />
23    );
24}
25
26export const Route = createFileRoute('/_dashboard/hosts/$hostId/delete')({
27    component: HostDelete,
28})