refactor(web): common layout for user pages (#1995)

* refactor(web): common layout for user pages

* remove unused imports
This commit is contained in:
Michel Heusschen
2023-03-18 22:31:15 +01:00
committed by GitHub
parent dd02f1025f
commit 9a332074c7
17 changed files with 437 additions and 552 deletions
@@ -1,21 +1,16 @@
import { AppRoute } from '$lib/constants';
import { redirect } from '@sveltejs/kit';
export const prerender = false;
import type { PageServerLoad } from './$types';
export const load: PageServerLoad = async ({ parent }) => {
try {
const { user } = await parent();
if (!user) {
throw redirect(302, '/auth/login');
}
return {
user,
meta: {
title: 'Shared Links'
}
};
} catch (e) {
throw redirect(302, '/auth/login');
export const load = (async ({ locals: { user } }) => {
if (!user) {
throw redirect(302, AppRoute.AUTH_LOGIN);
}
};
return {
user,
meta: {
title: 'Shared Links'
}
};
}) satisfies PageServerLoad;