tatorte only available via token

This commit is contained in:
2025-06-23 14:46:09 +02:00
parent 5be47343c4
commit bb98c3656e
10 changed files with 48 additions and 67 deletions

View File

@@ -1,10 +1,16 @@
import { type ServerLoadEvent } from '@sveltejs/kit';
import type { PageServerLoad } from '../anmeldung/$types';
import { checkIfVorgangExists, hasValidToken } from '$lib/server/vorgangService';
import { redirect } from '@sveltejs/kit';
import type { PageServerLoad } from './list/[vorgang]/$types';
export const load: PageServerLoad = async ({params, url}) => {
const caseId = params.vorgang;
const caseToken = url.searchParams.get('token');
const isVorgangValid = await checkIfVorgangExists(caseId);
const isTokenValid = await hasValidToken(caseId, caseToken);
if(!isVorgangValid || !isTokenValid) throw redirect(303, `/anmeldung`);
export const load: PageServerLoad = (event: ServerLoadEvent) => {
if (event.locals.user) {
return {
user: event.locals.user
};
}
};