core: edit renderView engine

to display 404 error on not found page
This commit is contained in:
starnakin 2023-12-21 00:04:48 +01:00
parent 5ba432e9fd
commit 0626faae7f

View File

@ -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;
};