Open History to see the last commit
1import { SignIn } from '@clerk/tanstack-react-start'
2import { createFileRoute } from '@tanstack/react-router'
3β
4export const Route = createFileRoute('/_authed')({
5 beforeLoad: ({ context }) => {
6 if (!context.userId) {
7 throw new Error('Not authenticated')
8 }
9 },
10 errorComponent: ({ error }) => {
11 if (error instanceof Error && error.message === 'Not authenticated') {
12 return (
13 <div className="flex items-center justify-center p-12">
14 <SignIn routing="hash" forceRedirectUrl={window.location.href} />
15 </div>
16 )
17 }
18β
19 throw error
20 },
21})