Skip to content

Commit 61d20bd

Browse files
committed
feat (profile): converted settings page to profile page (WIP)
1 parent 773c803 commit 61d20bd

File tree

5 files changed

+532
-29
lines changed

5 files changed

+532
-29
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// src/client/app/api/settings/profile/route.js
2+
import { NextResponse } from "next/server"
3+
import { withAuth } from "@lib/api-utils"
4+
5+
const appServerUrl =
6+
process.env.NEXT_PUBLIC_ENVIRONMENT === "SELFHOST"
7+
? process.env.INTERNAL_APP_SERVER_URL
8+
: process.env.NEXT_PUBLIC_APP_SERVER_URL
9+
10+
export const POST = withAuth(async function POST(request, { authHeader }) {
11+
try {
12+
const body = await request.json()
13+
const response = await fetch(`${appServerUrl}/api/settings/profile`, {
14+
method: "POST",
15+
headers: { "Content-Type": "application/json", ...authHeader },
16+
body: JSON.stringify(body)
17+
})
18+
19+
const data = await response.json()
20+
if (!response.ok) {
21+
throw new Error(data.detail || "Failed to update profile")
22+
}
23+
return NextResponse.json(data)
24+
} catch (error) {
25+
console.error("API Error in /settings/profile (POST):", error)
26+
return NextResponse.json(
27+
{ error: "Internal Server Error", details: error.message },
28+
{ status: 500 }
29+
)
30+
}
31+
})

0 commit comments

Comments
 (0)