Skip to content

Commit

Permalink
Add redirect to dashboard if visitng home logged-in
Browse files Browse the repository at this point in the history
  • Loading branch information
franknoirot committed Oct 20, 2023
1 parent 696e80b commit 6c8f1cf
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/routes/+page.server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { redirect } from '@sveltejs/kit'

export const load = async ({ cookies }) => {
const token = cookies.get('__Secure-next-auth.session-token')

if (token) {
throw redirect(302, '/dashboard')
}
}

0 comments on commit 6c8f1cf

Please sign in to comment.