remove unnecesarry deps since moving to authjs
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user