merge two server hook files

This commit is contained in:
themodernhakr 2024-12-23 19:50:38 -06:00
parent bc0782987a
commit c943408a89
2 changed files with 10 additions and 10 deletions

View File

@ -1,5 +1,15 @@
import type { Handle } from '@sveltejs/kit';
import * as auth from '$lib/server/auth.js';
import { dev } from '$app/environment';
import { db } from '$lib/server/db';
import type { ServerInit } from '@sveltejs/kit';
import { migrate } from 'drizzle-orm/bun-sqlite/migrator';
export const init: ServerInit = async () => {
if (!dev) {
await migrate(db, { migrationsFolder: './drizzle' });
}
};
const handleAuth: Handle = async ({ event, resolve }) => {
const sessionToken = event.cookies.get(auth.sessionCookieName);

View File

@ -1,10 +0,0 @@
import { dev } from '$app/environment';
import { db } from '$lib/server/db';
import type { ServerInit } from '@sveltejs/kit';
import { migrate } from 'drizzle-orm/bun-sqlite/migrator';
export const init: ServerInit = async () => {
if (!dev) {
await migrate(db, { migrationsFolder: './drizzle' });
}
};