mirror of
https://github.com/maputnik/editor.git
synced 2026-08-29 00:17:27 +00:00
Compare commits
4 Commits
v3.1.0
...
7d96be4ee5
| Author | SHA1 | Date | |
|---|---|---|---|
| 7d96be4ee5 | |||
| 28498d57f8 | |||
| 317448dc3f | |||
| 14391212bf |
@@ -8,6 +8,8 @@
|
|||||||
- _...Add new stuff here..._
|
- _...Add new stuff here..._
|
||||||
|
|
||||||
### 🐞 Bug fixes
|
### 🐞 Bug fixes
|
||||||
|
|
||||||
|
- Fix incorrect handing of network error response (#944)
|
||||||
- _...Add new stuff here..._
|
- _...Add new stuff here..._
|
||||||
|
|
||||||
## 2.1.1
|
## 2.1.1
|
||||||
|
|||||||
@@ -5,14 +5,17 @@ function loadJSON(url: string, defaultValue: any, cb: (...args: any[]) => void)
|
|||||||
mode: 'cors',
|
mode: 'cors',
|
||||||
credentials: "same-origin"
|
credentials: "same-origin"
|
||||||
})
|
})
|
||||||
.then(function(response) {
|
.then((response) => {
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error('Failed to load metadata for ' + url);
|
||||||
|
}
|
||||||
return response.json();
|
return response.json();
|
||||||
})
|
})
|
||||||
.then(function(body) {
|
.then((body) => {
|
||||||
cb(body)
|
cb(body)
|
||||||
})
|
})
|
||||||
.catch(function() {
|
.catch(() => {
|
||||||
console.warn('Can not metadata for ' + url)
|
console.warn('Can not load metadata for ' + url + ', using default value ' + defaultValue);
|
||||||
cb(defaultValue)
|
cb(defaultValue)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user