Move to next-auth
This commit is contained in:
parent
3b8bb9dea4
commit
a46b2ac3c6
10 changed files with 107 additions and 20 deletions
2
app/api/auth/[...nextauth]/route.ts
Normal file
2
app/api/auth/[...nextauth]/route.ts
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
export { GET, POST } from "@/auth";
|
||||
export const runtime = "edge";
|
||||
|
|
@ -3,7 +3,7 @@ import { prisma } from "@/lib/prisma";
|
|||
|
||||
import { Chat } from "../../chat";
|
||||
import { type Metadata } from "next";
|
||||
import { getServerSession } from "@/lib/session/get-server-session";
|
||||
import { auth } from "@/auth";
|
||||
|
||||
export interface ChatPageProps {
|
||||
params: {
|
||||
|
|
@ -29,7 +29,7 @@ export const runtime = "nodejs"; // default
|
|||
export const preferredRegion = "home";
|
||||
export const dynamic = "force-dynamic";
|
||||
export default async function ChatPage({ params }: ChatPageProps) {
|
||||
const session = await getServerSession();
|
||||
const session = await auth();
|
||||
const chat = await prisma.chat.findFirst({
|
||||
where: {
|
||||
id: params.id,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { getServerSession } from "@/lib/session/get-server-session";
|
||||
import { Chat } from "./chat";
|
||||
import { Sidebar } from "./sidebar";
|
||||
import { auth } from "@/auth";
|
||||
|
||||
// Prisma does not support Edge without the Data Proxy currently
|
||||
export const runtime = "nodejs"; // default
|
||||
|
|
@ -8,7 +8,7 @@ export const preferredRegion = "home";
|
|||
export const dynamic = "force-dynamic";
|
||||
|
||||
export default async function IndexPage() {
|
||||
const session = await getServerSession();
|
||||
const session = await auth();
|
||||
return (
|
||||
<div className="relative flex h-full w-full overflow-hidden">
|
||||
<Sidebar session={session} newChat />
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { NextChatLogo } from "@/components/ui/nextchat-logo";
|
|||
import { Login } from "@/components/ui/login";
|
||||
import { UserMenu } from "@/components/ui/user-menu";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
import { type Session } from "@/lib/session/types";
|
||||
import { type Session } from "@auth/nextjs/types";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { Plus } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
|
|
@ -70,7 +70,8 @@ async function SidebarList({ session }: { session?: Session }) {
|
|||
updatedAt: "desc",
|
||||
},
|
||||
}),
|
||||
[session?.user.id || ""],
|
||||
// @ts-ignore
|
||||
[session?.user?.id || ""],
|
||||
{
|
||||
revalidate: 3600,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue