change page function will change to a page based on pathname if no page name provided

This commit is contained in:
Miodec 2022-01-20 00:31:40 +01:00
parent 955c49b324
commit 44b809d3c1

View file

@ -121,6 +121,23 @@ export function changePage(page, norestart = false) {
console.log(`change page ${page} stopped`);
return;
}
if (page == undefined) {
//use window loacation
let pages = {
"/": "test",
"/login": "login",
"/settings": "settings",
"/about": "about",
"/account": "account",
};
let path = pages[window.location.pathname];
if (!path) {
path = "test";
}
page = path;
}
console.log(`change page ${page}`);
let activePageElement = $(".page.active");
activePage = undefined;