fix(auth): migrate from next-auth to better-auth (#1453)
This commit is contained in:
parent
453f5bb3e6
commit
b4f595a68c
40 changed files with 668 additions and 390 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import type { NextRequest } from "next/server";
|
||||
import { auth } from "@/app/(auth)/auth";
|
||||
import { getSession } from "@/lib/auth";
|
||||
import { deleteAllChatsByUserId, getChatsByUserId } from "@/lib/db/queries";
|
||||
import { ChatbotError } from "@/lib/errors";
|
||||
|
||||
|
|
@ -17,7 +17,7 @@ export async function GET(request: NextRequest) {
|
|||
).toResponse();
|
||||
}
|
||||
|
||||
const session = await auth();
|
||||
const session = await getSession();
|
||||
|
||||
if (!session?.user) {
|
||||
return new ChatbotError("unauthorized:chat").toResponse();
|
||||
|
|
@ -34,7 +34,7 @@ export async function GET(request: NextRequest) {
|
|||
}
|
||||
|
||||
export async function DELETE() {
|
||||
const session = await auth();
|
||||
const session = await getSession();
|
||||
|
||||
if (!session?.user) {
|
||||
return new ChatbotError("unauthorized:chat").toResponse();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue