mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-30 04:44:28 +00:00
19 lines
448 B
TypeScript
19 lines
448 B
TypeScript
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: '/',
|
||
|
|
})
|
||
|
|
}
|
||
|
|
},
|
||
|
|
})
|