From 00b11f21131b75b01d9d504c59bd866011595aa3 Mon Sep 17 00:00:00 2001 From: Chneemann Date: Wed, 23 Sep 2026 09:27:38 +0200 Subject: [PATCH] feat(settings): connect status and color updates to profile API endpoint --- components/settings/SettingsView.tsx | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/components/settings/SettingsView.tsx b/components/settings/SettingsView.tsx index b334590..34847e8 100644 --- a/components/settings/SettingsView.tsx +++ b/components/settings/SettingsView.tsx @@ -37,13 +37,31 @@ export function SettingsView({ userId, currentUser }: SettingsViewProps) { ]; /** Updates local status state on user selection. */ - const handleStatusChange = (newStatus: UserStatus) => { + const handleStatusChange = async (newStatus: UserStatus) => { setSelectedStatus(newStatus); + try { + await fetch("/api/users/profile", { + method: "PATCH", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ status: newStatus }), + }); + } catch (err) { + console.error("Failed to update status", err); + } }; /** Updates local avatar color state on user selection. */ - const handleColorChange = (newColor: string) => { + const handleColorChange = async (newColor: string) => { setSelectedColor(newColor); + try { + await fetch("/api/users/profile", { + method: "PATCH", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ color: newColor }), + }); + } catch (err) { + console.error("Failed to update color", err); + } }; if (!currentUser) return null;