gitscope
← marzneshin / v0.6.0 / dashboard/src/routes/_dashboard/hosts/$inboundId/create.tsx
https://dev.kronoz.win/r/marzneshin.git
dashboard/src/routes/_dashboard/hosts/$inboundId/create.tsx · TypeScript
Blame Raw
 1import { createFileRoute, useNavigate } from "@tanstack/react-router";
 2import { HostsMutationDialog } from "@marzneshin/features/hosts";
 3import { AlertDialog, AlertDialogContent } from "@marzneshin/components";
 4
 5const HostCreate = () => {
 6    const { inboundId } = Route.useParams();
 7    const navigate = useNavigate({ from: "/hosts/$inboundId/create" });
 8
 9    return (
10        <HostsMutationDialog
11            entity={null}
12            inboundId={Number(inboundId)}
13            onClose={() => navigate({ to: "/hosts" })}
14        />
15    );
16}
17
18export const Route = createFileRoute('/_dashboard/hosts/$inboundId/create')({
19    errorComponent: () => (
20        <AlertDialog open={true}>
21            <AlertDialogContent>Host not found</AlertDialogContent>
22        </AlertDialog>
23    ),
24    component: HostCreate,
25});