From aa1b57bbcd99da4c6d68c145f7c07ea7bd35c8dc Mon Sep 17 00:00:00 2001 From: Dhravya Date: Fri, 23 Feb 2024 16:04:49 -0700 Subject: chaos --- apps/web/src/app/api/auth/[...nextauth]/route.ts | 9 ++------- apps/web/src/app/api/store/route.ts | 3 ++- 2 files changed, 4 insertions(+), 8 deletions(-) (limited to 'apps/web/src/app/api') diff --git a/apps/web/src/app/api/auth/[...nextauth]/route.ts b/apps/web/src/app/api/auth/[...nextauth]/route.ts index 1570f886..db7d1fb8 100644 --- a/apps/web/src/app/api/auth/[...nextauth]/route.ts +++ b/apps/web/src/app/api/auth/[...nextauth]/route.ts @@ -1,7 +1,2 @@ -import NextAuth from "next-auth"; - -import { authOptions } from "@/server/auth"; - -// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -const handler = NextAuth(authOptions); -export { handler as GET, handler as POST }; +export { GET, POST } from "@/server/auth"; +export const runtime = "edge"; diff --git a/apps/web/src/app/api/store/route.ts b/apps/web/src/app/api/store/route.ts index 5c7e76d5..0d1c38ff 100644 --- a/apps/web/src/app/api/store/route.ts +++ b/apps/web/src/app/api/store/route.ts @@ -3,6 +3,8 @@ import { eq } from "drizzle-orm"; import { sessions, users } from "@/server/db/schema"; import { type NextRequest, NextResponse } from "next/server"; +export const runtime = "edge"; + export async function GET(req: NextRequest) { try { const token = req.cookies.get("next-auth.session-token")?.value ?? req.headers.get("Authorization")?.replace("Bearer ", ""); @@ -13,7 +15,6 @@ export async function GET(req: NextRequest) { if (!session || session.length === 0) { return NextResponse.json({ message: "Invalid Key, session not found." }, { status: 404 }); } - return NextResponse.json({ message: "OK", data: session[0] }, { status: 200 }); } catch (error) { return NextResponse.json({ message: "Error", error }, { status: 500 }); -- cgit v1.2.3