redirect login home page
This commit is contained in:
12
src/routes/+page.server.ts
Normal file
12
src/routes/+page.server.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { redirect } from '@sveltejs/kit';
|
||||
import type { LayoutServerLoad } from './$types';
|
||||
|
||||
export const load: LayoutServerLoad = async ({ locals }) => {
|
||||
if (!locals.user) {
|
||||
throw redirect(303, '/login');
|
||||
}
|
||||
|
||||
return {
|
||||
user: locals.user
|
||||
};
|
||||
};
|
||||
8
src/routes/backoffice/+page.server.ts
Normal file
8
src/routes/backoffice/+page.server.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { redirect } from "@sveltejs/kit";
|
||||
|
||||
export const load = async (event) => {
|
||||
if (!event.locals.user){
|
||||
console.log(event.url)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user