Handle redirects from /api/content on manifest.json gracefully (#3315)
* Add redirect follow mode to manifest.json * Remove (now) unused count parameter * autoRewrite: true for dev mode proxy redirects Former-commit-id: 73143932199b78961760208a9f20dac62b55f0bd
This commit is contained in:
committed by
Arkadiy Paronyan
parent
e8d6c3a699
commit
8660b057bf
@@ -197,24 +197,15 @@ export default class DappsStore {
|
||||
});
|
||||
}
|
||||
|
||||
_fetchManifest (manifestHash, count = 0) {
|
||||
return fetch(`${this._getHost()}/api/content/${manifestHash}/`)
|
||||
_fetchManifest (manifestHash) {
|
||||
return fetch(`${this._getHost()}/api/content/${manifestHash}/`, { redirect: 'follow', mode: 'cors' })
|
||||
.then((response) => {
|
||||
if (response.ok) {
|
||||
return response.json();
|
||||
}
|
||||
|
||||
if (count < 1) {
|
||||
return this._fetchManifest(manifestHash, count + 1);
|
||||
}
|
||||
|
||||
return null;
|
||||
return response.ok
|
||||
? response.json()
|
||||
: null;
|
||||
})
|
||||
.catch(() => {
|
||||
if (count < 1) {
|
||||
return this._fetchManifest(manifestHash, count + 1);
|
||||
}
|
||||
|
||||
.catch((error) => {
|
||||
console.warn('DappsStore:fetchManifest', error);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user