From da2997c5647a1f13bad621cb0cd23b79b6e6091c Mon Sep 17 00:00:00 2001 From: xarmian Date: Mon, 13 Apr 2026 01:41:41 +0000 Subject: [PATCH] fix: check HTTP status in admin settings save (PR #91) savePlatformSettings used raw fetch which doesn't throw on 4xx/5xx, so failed saves (CSRF rejection, auth errors) silently showed "Saved". Now checks resp.ok before reporting success. Co-Authored-By: Claude --- web/src/routes/console/admin/+page.svelte | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web/src/routes/console/admin/+page.svelte b/web/src/routes/console/admin/+page.svelte index 0fed14be..6619d5ab 100644 --- a/web/src/routes/console/admin/+page.svelte +++ b/web/src/routes/console/admin/+page.svelte @@ -161,12 +161,13 @@ const headers: Record = { 'Content-Type': 'application/json' }; const csrf = getCSRFToken(); if (csrf) headers['X-CSRF-Token'] = csrf; - await fetch(BASE + '/admin/settings', { + const resp = await fetch(BASE + '/admin/settings', { method: 'PATCH', credentials: 'same-origin', headers, body: JSON.stringify(platformSettings) }); + if (!resp.ok) throw new Error(`${resp.status}`); platformStatus = 'saved'; setTimeout(() => (platformStatus = 'idle'), 2000); } catch {