Supra_App/src/routes/(authed)/+layout.server.ts
pakintada@gmail.com 451223816b init
2026-02-17 14:30:02 +07:00

14 lines
442 B
TypeScript

import { auth } from '$lib/core/stores/auth.js';
import { departmentStore } from '$lib/core/stores/departments.ts';
import { redirect } from '@sveltejs/kit';
import { get } from 'svelte/store';
export async function load({ cookies, url }) {
if (!cookies.get('logged_in')) {
redirect(303, `/login?redirectTo=${url.pathname}`);
}
if (url.pathname.includes('recipe') && !cookies.get('department')) {
redirect(303, `/departments`);
}
}