mirror of
https://github.com/TheRealOwenRees/chess-scribe-website.git
synced 2026-07-23 01:46:57 +00:00
30 lines
693 B
TypeScript
30 lines
693 B
TypeScript
import { createFileRoute, notFound } from "@tanstack/react-router";
|
|
import { z } from "zod";
|
|
import GenericErrorView from "#/components/GenericErrorView.tsx";
|
|
import Callback from "#/pages/Callback.tsx";
|
|
|
|
const callbackSchema = z.object({
|
|
code: z.string(),
|
|
});
|
|
|
|
export const Route = createFileRoute("/callback")({
|
|
head: () => ({
|
|
meta: [{ name: "robots", content: "noindex, nofollow" }],
|
|
}),
|
|
|
|
validateSearch: (search) => callbackSchema.parse(search),
|
|
|
|
beforeLoad: ({ search }) => {
|
|
if (!search.code) {
|
|
throw notFound();
|
|
}
|
|
},
|
|
|
|
component: RouteComponent,
|
|
errorComponent: ({ error }) => <GenericErrorView error={error} />,
|
|
});
|
|
|
|
function RouteComponent() {
|
|
return <Callback />;
|
|
}
|