remove unnecesarry deps since moving to authjs

This commit is contained in:
2024-02-19 23:17:16 +01:00
parent e99351c670
commit 968c170cba
6 changed files with 8 additions and 627 deletions

View File

@@ -1,4 +1,3 @@
import { authenticateUser } from "$lib/js/authenticate"
import type { Handle } from "@sveltejs/kit"
import { redirect } from "@sveltejs/kit"
import { error } from "@sveltejs/kit"
@@ -13,13 +12,13 @@ async function authorization({ event, resolve }) {
if (event.url.pathname.startsWith('/rezepte/edit') || event.url.pathname.startsWith('/rezepte/add')) {
const session = await event.locals.getSession();
if (!session) {
throw redirect(303, '/auth/signin');
redirect(303, '/auth/signin');
}
else if (! session.user.groups.includes('rezepte_users')) {
// strip last dir from url
// TODO: give indication of why access failed
const new_url = event.url.pathname.split('/').slice(0, -1).join('/');
throw redirect(303, new_url);
redirect(303, new_url);
}
}