Files
shumai/packages/webui/routes/reset-password.tsx
T

19 lines
448 B
TypeScript
Raw Normal View History

import { createFileRoute, redirect } from '@tanstack/react-router'
import { useAuthStore } from '@/ui/stores/auth'
import { z } from 'zod'
const searchSchema = z.object({
token: z.string().catch(''),
})
export const Route = createFileRoute('/reset-password')({
validateSearch: (search) => searchSchema.parse(search),
beforeLoad: () => {
if (useAuthStore.getState().user) {
throw redirect({
to: '/',
})
}
},
})