mirror of
https://github.com/immich-app/immich.git
synced 2026-03-16 14:39:20 -04:00
15 lines
409 B
TypeScript
15 lines
409 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;
|