add report pagination
All checks were successful
delpoy / build-and-deploy (push) Successful in 40s

This commit is contained in:
2024-01-10 23:41:51 +01:00
parent f74f1fe19e
commit 6d9f3c41aa
3 changed files with 29 additions and 10 deletions

View File

@ -1,18 +1,15 @@
import type { PageServerLoad } from './$types';
import { redirect } from '@sveltejs/kit';
import { env } from '$env/dynamic/public';
import { getSession } from '$lib/server/session';
import { Permissions } from '$lib/permissions';
import { StrikeReason } from '$lib/server/database';
export const load: PageServerLoad = async ({ parent, cookies }) => {
export const load: PageServerLoad = async ({ parent }) => {
const { reportCount } = await parent();
if (reportCount == null) throw redirect(302, `${env.PUBLIC_BASE_PATH}/admin`);
const { self } = await parent();
return {
count: getSession(cookies, { permissions: [Permissions.UserRead] }) != null ? reportCount : 0,
strike_reasons: JSON.parse(JSON.stringify(await StrikeReason.findAll())),
self: self
};