diff --git a/apps/web/src/app/api/spaces/route.ts b/apps/web/src/app/api/spaces/route.ts index 1e1aeba7..d2685e9f 100644 --- a/apps/web/src/app/api/spaces/route.ts +++ b/apps/web/src/app/api/spaces/route.ts @@ -3,8 +3,9 @@ import { sessions, space, users } from "@/server/db/schema"; import { eq } from "drizzle-orm"; import { NextRequest, NextResponse } from "next/server"; -export async function GET(req: NextRequest) { +export const runtime = "edge"; +export async function GET(req: NextRequest) { const token = req.cookies.get("next-auth.session-token")?.value ?? req.cookies.get("__Secure-authjs.session-token")?.value ?? @@ -53,18 +54,19 @@ export async function GET(req: NextRequest) { ); } - const user = userData[0] + const user = userData[0]; - - const spaces = await db - .select() - .from(space) - .where(eq(space.user, user.id)) - .all() - - return NextResponse.json({ - message: "OK", - data: spaces - }, { status: 200 }) + const spaces = await db + .select() + .from(space) + .where(eq(space.user, user.id)) + .all(); + return NextResponse.json( + { + message: "OK", + data: spaces, + }, + { status: 200 }, + ); }