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