Files
Musify/frontend/src/routes/+layout.server.ts
T
Admin f155ccc912 feat(frontend): add (app) route group and rework auth routing
Move authenticated pages under an (app) group with a Sidebar shell, add /auth/login and page-based /login, drop the old explore page and login +server endpoint, and add the server upload helper.
2026-07-14 04:55:04 +02:00

12 lines
375 B
TypeScript

import { redirect } from '@sveltejs/kit';
import type { LayoutServerLoad } from './$types';
const PUBLIC_PATHS = new Set(['/login']);
export const load: LayoutServerLoad = ({ locals, url }) => {
if (!locals.user && !PUBLIC_PATHS.has(url.pathname)) {
redirect(302, `/login?returnTo=${encodeURIComponent(url.pathname + url.search)}`);
}
return { user: locals.user };
};