opti: do not execute postInit if getHtml is null
This commit is contained in:
parent
d5e692449b
commit
07d06253ba
@ -59,7 +59,11 @@ const router = async () => {
|
||||
}
|
||||
const view = new match.route.view(getParams(match));
|
||||
|
||||
document.querySelector("#app").innerHTML = await view.getHtml();
|
||||
let content = await view.getHtml();
|
||||
if (content == null)
|
||||
return;
|
||||
|
||||
document.querySelector("#app").innerHTML = content
|
||||
|
||||
await view.postInit();
|
||||
};
|
||||
|
@ -35,9 +35,7 @@ export default class extends AbstractView {
|
||||
|
||||
async postInit()
|
||||
{
|
||||
let login_button = document.getElementById("button")
|
||||
if (login_button != null)
|
||||
login_button.onclick = login;
|
||||
document.getElementById("button").onclick = login;
|
||||
}
|
||||
|
||||
async getHtml() {
|
||||
|
@ -30,14 +30,11 @@ export default class extends AbstractView {
|
||||
|
||||
async postInit()
|
||||
{
|
||||
let register_button = document.getElementById("button")
|
||||
if (register_button != null)
|
||||
register_button.onclick = register;
|
||||
|
||||
document.getElementById("button").onclick = register;
|
||||
}
|
||||
|
||||
async getHtml() {
|
||||
if (client.isAuthentificate())
|
||||
if (await client.isAuthentificate())
|
||||
{
|
||||
navigateTo("/home")
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user