Add a 'invalid URL' view

This commit is contained in:
Danila Fedorin
2021-08-30 12:05:42 -07:00
parent 628e99ba2d
commit e4aeadecd7
3 changed files with 36 additions and 0 deletions
+5
View File
@@ -30,6 +30,7 @@ export class RootViewModel extends ViewModel {
this.createLinkViewModel = null;
this.loadServerPolicyViewModel = null;
this.showDisclaimer = false;
this.invalidUrl = false;
this.preferences.on("canClear", () => {
this.emitChange();
});
@@ -58,6 +59,7 @@ export class RootViewModel extends ViewModel {
// clear them to avoid having to manually reset (n-1)/n view models in every case.
// That just doesn't scale well when we add new views.
const oldLink = this.link;
this.invalidUrl = false;
this.showDisclaimer = false;
this.loadServerPolicyViewModel = null;
this.createLinkViewModel = null;
@@ -75,6 +77,9 @@ export class RootViewModel extends ViewModel {
this.createLinkViewModel = new CreateLinkViewModel(this.childOptions());
} else if (newLink = Link.parse(hash)) {
this._updateChildVMs(newLink, oldLink);
} else {
this._updateChildVMs(null, oldLink);
this.invalidUrl = true;
}
this.emitChange();
}