diff --git a/src/app/(app)/profile/page.tsx b/src/app/(app)/profile/page.tsx index 4a8c1b8..8ea8b17 100644 --- a/src/app/(app)/profile/page.tsx +++ b/src/app/(app)/profile/page.tsx @@ -121,7 +121,7 @@ function Mobile() { "requests", JSON.stringify(requests.filter((req: string) => req !== request)) ); - fetch(`/api/user/${session?.id}`, { + fetch(`/api/me`, { method: "POST", body: formData, }) diff --git a/src/app/api/me/route.ts b/src/app/api/me/route.ts index 68820cd..564c049 100644 --- a/src/app/api/me/route.ts +++ b/src/app/api/me/route.ts @@ -68,8 +68,7 @@ export async function POST(req: Request) { let requests = formData.get("requests"); if(requests) { - if(!Array.isArray(requests)) return NextResponse.json({ message: "Invalid requests data" }, { status: 400 }); - userData = await db.users.update(userData.id, { requests }); + userData = await db.users.update(userData.id, { requests: JSON.parse(requests.toString()) }); if (!userData) return NextResponse.json({ message: "Failed to update requests" }, { status: 500 }); }