Refactor to use hooks (#436)
This commit is contained in:
parent
124efca9a1
commit
cb60f8b143
139 changed files with 8871 additions and 8726 deletions
13
app/(chat)/api/history/route.ts
Normal file
13
app/(chat)/api/history/route.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import { auth } from "@/app/(auth)/auth";
|
||||
import { getChatsByUserId } from "@/db/queries";
|
||||
|
||||
export async function GET() {
|
||||
const session = await auth();
|
||||
|
||||
if (!session || !session.user) {
|
||||
return Response.json("Unauthorized!", { status: 401 });
|
||||
}
|
||||
|
||||
const chats = await getChatsByUserId({ id: session.user.id! });
|
||||
return Response.json(chats);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue