From 8981e08d0b719955bed0446bd7f96a63c7f2fad0 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Mar 2026 21:59:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 19cffad..dbd25e6 100644 --- a/index.html +++ b/index.html @@ -428,10 +428,12 @@ }); } - fetch('api.config.json').catch(function() { - return { json: function() { return Promise.resolve({ apiBase: '' }); } }; + fetch('api.config.json') + .then(function(r) { + if (!r.ok) return Promise.resolve({ apiBase: '' }); + return typeof r.json === 'function' ? r.json().catch(function() { return { apiBase: '' }; }) : Promise.resolve({ apiBase: '' }); }) - .then(function(r) { return typeof r.json === 'function' ? r.json() : Promise.resolve({ apiBase: '' }); }) + .catch(function() { return Promise.resolve({ apiBase: '' }); }) .then(function(apiConfig) { API = (apiConfig.apiBase || '').replace(/\/$/, '') + '/api'; var xhr = new XMLHttpRequest();