add report admin panel
All checks were successful
delpoy / build-and-deploy (push) Successful in 53s
All checks were successful
delpoy / build-and-deploy (push) Successful in 53s
This commit is contained in:
17
src/routes/admin/reports/+page.server.ts
Normal file
17
src/routes/admin/reports/+page.server.ts
Normal file
@ -0,0 +1,17 @@
|
||||
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';
|
||||
|
||||
export const load: PageServerLoad = async ({ parent, cookies }) => {
|
||||
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,
|
||||
self: self
|
||||
};
|
||||
};
|
Reference in New Issue
Block a user