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

26 lines
608 B
TypeScript

import { AppRoute } from '$lib/constants';
import { redirect } from '@sveltejs/kit';
import type { PageServerLoad } from './$types';
export const load = (async ({ locals: { user, api } }) => {
if (!user) {
throw redirect(302, AppRoute.AUTH_LOGIN);
} else if (!user.isAdmin) {
throw redirect(302, AppRoute.PHOTOS);
}
try {
const { data: jobs } = await api.jobApi.getAllJobsStatus();
return {
jobs,
meta: {
title: 'Job Status',
},
};
} catch (err) {
console.error('[jobs] > getAllJobsStatus', err);
throw err;
}
}) satisfies PageServerLoad;