make session cookie name a variable
All checks were successful
delpoy / build-and-deploy (push) Successful in 27s
All checks were successful
delpoy / build-and-deploy (push) Successful in 27s
This commit is contained in:
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user