mirror of
https://github.com/FJurmanovic/wallet-web.git
synced 2026-02-06 14:18:08 +00:00
added child routes and dynamic routes
This commit is contained in:
@@ -42,17 +42,28 @@ class AppMainElement extends BaseComponentElement {
|
||||
layout: "menu-layout",
|
||||
middleware: this.isAuth,
|
||||
},
|
||||
{
|
||||
path: "/wallet",
|
||||
component: "history-page",
|
||||
layout: "menu-layout",
|
||||
middleware: this.isAuth,
|
||||
children: [
|
||||
{
|
||||
path: "/:walletId",
|
||||
component: "history-page",
|
||||
layout: "menu-layout",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: "/register",
|
||||
component: "register-page",
|
||||
layout: "menu-layout",
|
||||
middleware: this.isAuth,
|
||||
},
|
||||
{
|
||||
path: "/login",
|
||||
component: "login-page",
|
||||
layout: "menu-layout",
|
||||
middleware: this.isAuth,
|
||||
},
|
||||
{
|
||||
path: "/unauthorized",
|
||||
@@ -64,6 +75,11 @@ class AppMainElement extends BaseComponentElement {
|
||||
component: "login-page",
|
||||
layout: "menu-layout",
|
||||
},
|
||||
{
|
||||
path: "/not-found",
|
||||
component: "not-found",
|
||||
layout: "menu-layout",
|
||||
},
|
||||
{
|
||||
path: "/logout",
|
||||
component: "logout-page",
|
||||
@@ -81,6 +97,7 @@ class AppMainElement extends BaseComponentElement {
|
||||
|
||||
createModal = (element: string) => {
|
||||
this.closeModal();
|
||||
this.appMain.addEventListener("routechanged", this.closeModal);
|
||||
|
||||
const _appModal = this.createAppModal();
|
||||
const _modalContent = this.createModalContent(element);
|
||||
@@ -131,6 +148,7 @@ class AppMainElement extends BaseComponentElement {
|
||||
|
||||
closeModal = () => {
|
||||
if (this.appModal) this.removeChild(this.appModal);
|
||||
this.appMain.removeEventListener("routechanged", this.closeModal);
|
||||
};
|
||||
|
||||
isAuth = (): boolean => {
|
||||
|
||||
Reference in New Issue
Block a user