fix:修复
This commit is contained in:
@@ -428,10 +428,12 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch('api.config.json').catch(function() {
|
fetch('api.config.json')
|
||||||
return { json: function() { return Promise.resolve({ apiBase: '' }); } };
|
.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) {
|
.then(function(apiConfig) {
|
||||||
API = (apiConfig.apiBase || '').replace(/\/$/, '') + '/api';
|
API = (apiConfig.apiBase || '').replace(/\/$/, '') + '/api';
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
|
|||||||
Reference in New Issue
Block a user