Merge branch 'Chatte' into feat/accounts

This commit is contained in:
2023-11-29 18:36:08 +01:00
14 changed files with 62 additions and 5 deletions

View File

@ -12,6 +12,8 @@ import { Client } from "./api/client.js";
let client = new Client(location.protocol + "//" + location.host)
let lastView = undefined
const pathToRegex = path => new RegExp("^" + path.replace(/\//g, "\\/").replace(/:\w+/g, "(.+)") + "$");
const getParams = match => {
@ -57,7 +59,12 @@ const router = async (uri = "") => {
result: [uri]
};
}
if (lastView !== undefined)
await lastView.leavePage();
const view = new match.route.view(getParams(match));
lastView = view;
let content = await view.getHtml();
if (content == null)
@ -81,4 +88,4 @@ document.addEventListener("DOMContentLoaded", () => {
router(location.pathname);
});
export { client, navigateTo }
export { client, navigateTo }