diff --git a/ui/src/routes/admin/+layout.server.ts b/ui/src/routes/admin/+layout.server.ts new file mode 100644 index 0000000..24471a4 --- /dev/null +++ b/ui/src/routes/admin/+layout.server.ts @@ -0,0 +1,8 @@ +import { redirect } from '@sveltejs/kit'; +import type { LayoutServerLoad } from './$types'; + +export const load: LayoutServerLoad = async ({ locals }) => { + if (locals.user?.role !== 'admin') { + redirect(302, '/'); + } +}; diff --git a/ui/src/routes/admin/+page.server.ts b/ui/src/routes/admin/+page.server.ts new file mode 100644 index 0000000..fdc1ac3 --- /dev/null +++ b/ui/src/routes/admin/+page.server.ts @@ -0,0 +1,6 @@ +import { redirect } from '@sveltejs/kit'; +import type { PageServerLoad } from './$types'; + +export const load: PageServerLoad = async () => { + redirect(302, '/admin/scrape'); +};