Files
immich/web/src/routes/admin/user-management/+page.server.ts
Jason Rasmussen f55b3add80 chore(web): prettier (#2821)
Co-authored-by: Thomas Way <thomas@6f.io>
2023-06-30 23:50:47 -05:00

24 lines
569 B
TypeScript

import { AppRoute } from '$lib/constants';
import { redirect } from '@sveltejs/kit';
import type { PageServerLoad } from './$types';
export const load = (async ({ parent, locals: { api } }) => {
const { user } = await parent();
if (!user) {
throw redirect(302, AppRoute.AUTH_LOGIN);
} else if (!user.isAdmin) {
throw redirect(302, AppRoute.PHOTOS);
}
const { data: allUsers } = await api.userApi.getAllUsers({ isAll: false });
return {
user,
allUsers,
meta: {
title: 'User Management',
},
};
}) satisfies PageServerLoad;