From 1f885406ddd503435edb3f2f678dff506f93ed8b Mon Sep 17 00:00:00 2001 From: Momentry Studio Date: Tue, 27 Oct 2026 02:40:45 +0800 Subject: [PATCH] fix: allow saving admin config when config file doesn't exist - saveConfig no longer throws error when current config returns 404 - Creates new config file with current values if none exists - User can save config for the first time without errors --- src/views/AdminView.vue | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/views/AdminView.vue b/src/views/AdminView.vue index 0c6bdeb..37b72fc 100644 --- a/src/views/AdminView.vue +++ b/src/views/AdminView.vue @@ -1327,9 +1327,13 @@ async function saveConfig() { configSaving.value = true configSaveMsg.value = '' try { + // Try to load current config, but don't fail if it doesn't exist + let currentConfig: any = {} const res = await fetch('/api/v1/admin/config') - if (!res.ok) throw new Error(`Failed to load current config: HTTP ${res.status}`) - const currentConfig = await res.json() + if (res.ok) { + currentConfig = await res.json() + } + // If 404, just use empty currentConfig - we'll create a new file const payload = { version: '1.0.0',