From 5de9ae612da39496d2751cc09350f2ea893dbe1b Mon Sep 17 00:00:00 2001 From: Jared Palmer Date: Fri, 16 Jun 2023 14:18:49 -0400 Subject: [PATCH] Fix types --- app/api/chat/route.ts | 2 +- index.d.ts => next-auth.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename index.d.ts => next-auth.d.ts (93%) diff --git a/app/api/chat/route.ts b/app/api/chat/route.ts index beec80f..36087fd 100644 --- a/app/api/chat/route.ts +++ b/app/api/chat/route.ts @@ -40,7 +40,7 @@ export async function POST(req: Request) { const stream = OpenAIStream(res, { async onCompletion(completion) { const title = json.messages[0].content.substring(0, 100) - const userId = session.user.id + const userId = session.user?.id const id = json.id ?? nanoid() const createdAt = Date.now() const path = `/chat/${id}` diff --git a/index.d.ts b/next-auth.d.ts similarity index 93% rename from index.d.ts rename to next-auth.d.ts index 5b3f52b..918e14d 100644 --- a/index.d.ts +++ b/next-auth.d.ts @@ -7,7 +7,7 @@ declare module 'next-auth' { interface Session { user: { /** The user's postal address. */ - address: string + id: string } & DefaultSession['user'] } }