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,11 +1,10 @@
|
|||
import { cookies } from "next/headers";
|
||||
import { notFound, redirect } from "next/navigation";
|
||||
import { Suspense } from "react";
|
||||
|
||||
import { auth } from "@/app/(auth)/auth";
|
||||
import { Chat } from "@/components/chat";
|
||||
import { DataStreamHandler } from "@/components/data-stream-handler";
|
||||
import { DEFAULT_CHAT_MODEL } from "@/lib/ai/models";
|
||||
import { getSession } from "@/lib/auth";
|
||||
import { getChatById, getMessagesByChatId } from "@/lib/db/queries";
|
||||
import { convertToUIMessages } from "@/lib/utils";
|
||||
|
||||
|
|
@ -25,10 +24,10 @@ async function ChatPage({ params }: { params: Promise<{ id: string }> }) {
|
|||
redirect("/");
|
||||
}
|
||||
|
||||
const session = await auth();
|
||||
const session = await getSession();
|
||||
|
||||
if (!session) {
|
||||
redirect("/api/auth/guest");
|
||||
redirect("/login");
|
||||
}
|
||||
|
||||
if (chat.visibility === "private") {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue