Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { createFileRoute, redirect } from "@tanstack/react-router";
- import { z } from "zod";
- import WorkshopWizardApp from "../../pages/app";
- const appSearchSchema = z.object({
- view: z.enum(["dashboard", "application", "other"]).catch("dashboard"),
- });
- export type AppSearch = z.infer<typeof appSearchSchema>;
- export const Route: any = createFileRoute("/app/")({
- beforeLoad: ({ context, location }) => {
- console.log("Context Auth " + context.auth.isAuthenticated);
- if (context.auth.isAuthenticated === null || context.auth.isAuthenticated === false) {
- throw redirect({
- to: "/auth",
- search: {
- redirect: location.href,
- form: "signin",
- },
- });
- }
- },
- validateSearch: (search) => appSearchSchema.parse(search),
- component: () => <WorkshopWizardApp />,
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement