17 lines · 527 B · TypeScript
RawDownload
import { createFileRoute, redirect } from "@tanstack/react-router"; export const Route = createFileRoute("/projects/$projectKey")({  beforeLoad: async ({ context, params }) => {    if (      context.authGateState.status !== "authenticated" &&      context.authGateState.status !== "hosted-static"    ) {      throw redirect({ to: "/pair", replace: true });    }    throw redirect({      to: "/settings/projects",      search: { project: params.projectKey, machine: undefined },      replace: true,    });  },});