mirror of
https://github.com/FJurmanovic/wallet-web.git
synced 2026-11-11 07:41:09 +00:00
watch for browser back button press and update
This commit is contained in:
@@ -25,11 +25,11 @@ class AppMainElement extends HTMLElement {
|
||||
path: "/",
|
||||
component: "home-page",
|
||||
layout: "menu-layout",
|
||||
middleware: this.middleAuth,
|
||||
},
|
||||
{
|
||||
path: "/home",
|
||||
component: "home-page",
|
||||
middleware: this.isAuth,
|
||||
},
|
||||
{
|
||||
path: "/rb",
|
||||
@@ -47,12 +47,16 @@ class AppMainElement extends HTMLElement {
|
||||
this.routerService.init();
|
||||
}
|
||||
|
||||
isAuth = () => {
|
||||
if (this.authStore?.token == null) {
|
||||
middleAuth = () => {
|
||||
if (!this.isAuth) {
|
||||
this.routerService.goTo("/unauthorized");
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
get isAuth(): boolean {
|
||||
return this.authStore && this.authStore.token;
|
||||
}
|
||||
}
|
||||
|
||||
export type { AppMainElement };
|
||||
|
||||
Reference in New Issue
Block a user