make session cookie name a variable
All checks were successful
delpoy / build-and-deploy (push) Successful in 27s

This commit is contained in:
2023-08-29 14:52:27 +02:00
parent dd2c10a365
commit ccc022f5f0
4 changed files with 10 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
import { sequelize } from '$lib/server/database';
import type { Handle } from '@sveltejs/kit';
import { env } from '$env/dynamic/public';
import { getSession } from '$lib/server/session';
import { getSession, sessionCookieName } from '$lib/server/session';
// make sure that the database and tables exist
await sequelize.sync();
@@ -11,7 +11,7 @@ export const handle: Handle = async ({ event, resolve }) => {
event.url.pathname.startsWith(`${env.PUBLIC_BASE_PATH}/admin`) &&
event.url.pathname != `${env.PUBLIC_BASE_PATH}/admin/login`
) {
if (getSession(event.cookies.get('session') || '') == null) {
if (getSession(event.cookies.get(sessionCookieName) || '') == null) {
return new Response(null, {
status: 302,
headers: {