fixed architecture to dispatch events when routes and token changes

This commit is contained in:
Fran Jurmanović
2021-05-31 12:00:07 +02:00
parent 48df6fc7cf
commit e1ab0e51d6
10 changed files with 131 additions and 29 deletions

View File

@@ -43,7 +43,6 @@ class RouterService {
update() {
if (!this._routes) return;
window.dispatchEvent(this.domEvents.routechanged);
const path = window.location.pathname;
const _mainRoot = this.mainRoot;
const route = this.routerState;
@@ -98,12 +97,12 @@ class RouterService {
_mainRoot.appendChild(_newElement);
}
}
return;
} else {
const newRoute = this.findByPath();
this.historyStack.push(newRoute);
this.update();
}
window.dispatchEvent(this.domEvents.routechanged);
}
goTo(path: string) {