feat(settings): connect status and color updates to profile API endpoint
All checks were successful
Deploy Waveform to VPS / deploy (push) Successful in 1m18s

This commit is contained in:
Chneemann 2026-09-23 09:27:38 +02:00
parent ca9b35f8dd
commit 00b11f2113
No known key found for this signature in database

View file

@ -37,13 +37,31 @@ export function SettingsView({ userId, currentUser }: SettingsViewProps) {
]; ];
/** Updates local status state on user selection. */ /** Updates local status state on user selection. */
const handleStatusChange = (newStatus: UserStatus) => { const handleStatusChange = async (newStatus: UserStatus) => {
setSelectedStatus(newStatus); 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. */ /** Updates local avatar color state on user selection. */
const handleColorChange = (newColor: string) => { const handleColorChange = async (newColor: string) => {
setSelectedColor(newColor); 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; if (!currentUser) return null;