fix: back button is back

This commit is contained in:
starnakin 2023-12-11 15:54:56 +01:00
parent 2ccfc5464a
commit 85787760b9

View File

@ -32,7 +32,7 @@ const navigateTo = async (uri) => {
history.pushState(null, null, uri); history.pushState(null, null, uri);
}; };
const router = async (uri = "") => { const router = async (uri) => {
const routes = [ const routes = [
{ path: "/", view: Dashboard }, { path: "/", view: Dashboard },
{ path: "/profiles", view: ProfilesView}, { path: "/profiles", view: ProfilesView},
@ -84,7 +84,7 @@ const router = async (uri = "") => {
return 0; return 0;
}; };
window.addEventListener("popstate", router); window.addEventListener("popstate", function() {router(this.location.pathname)});
document.addEventListener("DOMContentLoaded", () => { document.addEventListener("DOMContentLoaded", () => {
document.body.addEventListener("click", e => { document.body.addEventListener("click", e => {