diff --git a/frontend/static/js/index.js b/frontend/static/js/index.js index 346eacb..f81cf96 100644 --- a/frontend/static/js/index.js +++ b/frontend/static/js/index.js @@ -35,6 +35,19 @@ const navigateTo = async (uri) => { history.pushState(null, null, uri); }; +async function renderView(view) +{ + let content = await view.getHtml(); + if (content == null) + return 1; + + view.setTitle(); + document.querySelector("#app").innerHTML = content + + if (await view.postInit()) + renderView(new PageNotFoundView()); +} + const router = async (uri) => { const routes = [ { path: "/", view: Dashboard }, @@ -80,14 +93,7 @@ const router = async (uri) => { lastView = view; await client.isAuthentificate(); - let content = await view.getHtml(); - if (content == null) - return 1; - - view.setTitle(); - document.querySelector("#app").innerHTML = content - - await view.postInit(); + renderView(view); return 0; };