Rollen Chunk 5b: Auth-Routen initialisieren frische Datenbanken
This commit is contained in:
1 parent
ccb71ea5d8
commit
474a551fba
1 file changed
+3
@@ -1,6 +1,7 @@
|
||||
import { toNextJsHandler } from "better-auth/next-js";
|
||||
import { NextResponse } from "next/server";
|
||||
import { getAuth } from "@/lib/auth";
|
||||
import { getDb, initializeDatabase } from "@/lib/db";
|
||||
|
||||
function disabled() {
|
||||
return NextResponse.json(
|
||||
@@ -19,6 +20,7 @@ export async function GET(request: Request) {
|
||||
if (!auth) {
|
||||
return disabled();
|
||||
}
|
||||
initializeDatabase(getDb());
|
||||
return toNextJsHandler(auth.handler).GET(request);
|
||||
}
|
||||
|
||||
@@ -27,5 +29,6 @@ export async function POST(request: Request) {
|
||||
if (!auth) {
|
||||
return disabled();
|
||||
}
|
||||
initializeDatabase(getDb());
|
||||
return toNextJsHandler(auth.handler).POST(request);
|
||||
}
|
||||
Reference in new issue
Block a user