ui collection load: retry loading if index api fails, smooth transition from previous version
This commit is contained in:
+3
-2
@@ -104,7 +104,7 @@ class CollIndex extends LitElement
|
|||||||
const resp = await fetch(`${apiPrefix}/coll-index?${this.indexParams}`);
|
const resp = await fetch(`${apiPrefix}/coll-index?${this.indexParams}`);
|
||||||
try {
|
try {
|
||||||
if (resp.status !== 200) {
|
if (resp.status !== 200) {
|
||||||
throw new Error("Invalid API Response");
|
throw new Error("Invalid API Response, Retry");
|
||||||
}
|
}
|
||||||
const json = await resp.json();
|
const json = await resp.json();
|
||||||
this.colls = json.colls.map((coll) => {
|
this.colls = json.colls.map((coll) => {
|
||||||
@@ -116,7 +116,8 @@ class CollIndex extends LitElement
|
|||||||
this.sortedColls = [];
|
this.sortedColls = [];
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// likely no sw registered yet, or waiting for new sw to register
|
// likely no sw registered yet, or waiting for new sw to register, retry again
|
||||||
|
setTimeout(() => this.loadColls(), 5000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user