Merge branch 'Chatte' into feat/accounts
This commit is contained in:
@ -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 }
|
Reference in New Issue
Block a user