static: make SiteShell redirect when request > 400
This commit is contained in:
2
passbook/static/static/dist/main.js
vendored
2
passbook/static/static/dist/main.js
vendored
File diff suppressed because one or more lines are too long
2
passbook/static/static/dist/main.js.map
vendored
2
passbook/static/static/dist/main.js.map
vendored
File diff suppressed because one or more lines are too long
@ -54,6 +54,14 @@ export class SiteShell extends LitElement {
|
|||||||
}
|
}
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
fetch(this._url)
|
fetch(this._url)
|
||||||
|
.then((r) => {
|
||||||
|
if (r.ok) {
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
console.log(`passbook/site-shell: Request failed ${this._url}`);
|
||||||
|
window.location.hash = "#/";
|
||||||
|
throw new Error("Request failed");
|
||||||
|
})
|
||||||
.then((r) => r.text())
|
.then((r) => r.text())
|
||||||
.then((t) => {
|
.then((t) => {
|
||||||
this.querySelector("[slot=body]")!.innerHTML = t;
|
this.querySelector("[slot=body]")!.innerHTML = t;
|
||||||
|
|||||||
Reference in New Issue
Block a user