mirror of
https://github.com/immich-app/immich.git
synced 2025-01-10 13:56:47 +01:00
f55b3add80
Co-authored-by: Thomas Way <thomas@6f.io>
14 lines
418 B
TypeScript
14 lines
418 B
TypeScript
import { AppRoute } from '$lib/constants';
|
|
import { redirect } from '@sveltejs/kit';
|
|
import type { LayoutLoad } from './$types';
|
|
|
|
export const load = (async ({ parent, route }) => {
|
|
const { user } = await parent();
|
|
if (!user) {
|
|
throw redirect(302, AppRoute.AUTH_LOGIN);
|
|
} else if (!user.isAdmin) {
|
|
throw redirect(302, AppRoute.PHOTOS);
|
|
}
|
|
|
|
return { routeId: route.id, user };
|
|
}) satisfies LayoutLoad;
|