Skip to content

Commit

Permalink
mark runtime=edge for spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhravya committed Apr 13, 2024
1 parent 0d6cd7c commit 18511b8
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions apps/web/src/app/api/spaces/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 ??
Expand Down Expand Up @@ -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 },
);
}

0 comments on commit 18511b8

Please sign in to comment.