fix:修复

This commit is contained in:
Daniel
2026-03-08 21:59:32 +08:00
parent 37203a1964
commit 8981e08d0b

View File

@@ -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();