Correct redirect from login page.

This commit is contained in:
Jesse Brault 2024-08-08 12:40:50 -05:00
parent 90feb0e963
commit 058577d676

View File

@ -65,7 +65,7 @@ export const Route = createFileRoute('/login')({
redirect: z.string().optional().catch('') redirect: z.string().optional().catch('')
}), }),
beforeLoad({ context, search }) { beforeLoad({ context, search }) {
if (!(search.reason !== undefined || context.auth.token === null)) { if (search.reason === undefined && context.auth.token !== null) {
throw redirect({ to: '/recipes' }) throw redirect({ to: '/recipes' })
} }
}, },