diff --git a/app/api/direct-messages/route.ts b/app/api/direct-messages/route.ts index 674796e..5996d1e 100644 --- a/app/api/direct-messages/route.ts +++ b/app/api/direct-messages/route.ts @@ -1,8 +1,8 @@ -import { currentProfile } from "@/lib/current-profile"; -import { db } from "@/lib/db"; +import { NextResponse } from "next/server"; import { DirectMessage } from "@prisma/client"; -import { NextResponse } from "next/server"; +import { currentProfile } from "@/lib/current-profile"; +import { db } from "@/lib/db"; const MESSAGES_BATCH = 10; @@ -45,7 +45,7 @@ export async function GET( }, orderBy: { createdAt: "desc", - }, + } }); } else { messages = await db.directMessage.findMany({ @@ -62,8 +62,8 @@ export async function GET( }, orderBy: { createdAt: "desc", - }, - }); + } + }) } let nextCursor = null; @@ -74,10 +74,10 @@ export async function GET( return NextResponse.json({ items: messages, - nextCursor, + nextCursor }); } catch (error) { console.log("[DIRECT_MESSAGES_GET]", error); - return new NextResponse("Internal Error", { status: 500 }) + return new NextResponse("Internal Error", { status: 500 }); } } \ No newline at end of file diff --git a/app/api/messages/route.ts b/app/api/messages/route.ts index 84b8065..065e04d 100644 --- a/app/api/messages/route.ts +++ b/app/api/messages/route.ts @@ -45,7 +45,7 @@ export async function GET( }, orderBy: { createdAt: "desc", - }, + } }); } else { messages = await db.message.findMany({ @@ -62,8 +62,8 @@ export async function GET( }, orderBy: { createdAt: "desc", - }, - }); + } + }) } let nextCursor = null; @@ -74,10 +74,10 @@ export async function GET( return NextResponse.json({ items: messages, - nextCursor, + nextCursor }); } catch (error) { console.log("[MESSAGES_GET]", error); - return new NextResponse("Internal Error", { status: 500 }) + return new NextResponse("Internal Error", { status: 500 }); } } \ No newline at end of file diff --git a/components/chat/chat-messages.tsx b/components/chat/chat-messages.tsx index 84f3c54..07fb464 100644 --- a/components/chat/chat-messages.tsx +++ b/components/chat/chat-messages.tsx @@ -71,7 +71,7 @@ export const ChatMessages = ({ }) - if (status === "pending") { + if (status === "loading") { return (