chore: enable auto redirect on layout mount

The use case for this is that if a person went from course page to invite page, and isn't authenticated then the user should be redirected to login page with a redirect query param
This commit is contained in:
Rotimi Best
2025-11-08 05:02:17 +01:00
parent 570b809111
commit 291e233700
3 changed files with 12 additions and 9 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
import type { Handle } from '@sveltejs/kit';
import { validateUser } from '$lib/utils/services/middlewares';
const PUBLIC_ROUTES = [
const PUBLIC_API_ROUTES = [
'/api/completion',
'student_prove_payment',
'teacher_student_buycourse',
@@ -11,7 +11,7 @@ const PUBLIC_ROUTES = [
];
function isPublicRoute(pathname: string) {
return PUBLIC_ROUTES.some((route) => pathname.includes(route));
return PUBLIC_API_ROUTES.some((route) => pathname.includes(route));
}
export const handle: Handle = async ({ event, resolve }) => {