add admin admin settings

This commit is contained in:
2023-08-28 04:31:58 +02:00
parent 4b84c475b8
commit 0958ff21b6
15 changed files with 524 additions and 28 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 { hasSession } from '$lib/server/session';
import { getSession } 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 (!hasSession(event.cookies.get('session') || '')) {
if (getSession(event.cookies.get('session') || '') == null) {
return new Response(null, {
status: 302,
headers: {