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));
|
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();
|
await view.postInit();
|
||||||
};
|
};
|
||||||
|
@ -35,9 +35,7 @@ export default class extends AbstractView {
|
|||||||
|
|
||||||
async postInit()
|
async postInit()
|
||||||
{
|
{
|
||||||
let login_button = document.getElementById("button")
|
document.getElementById("button").onclick = login;
|
||||||
if (login_button != null)
|
|
||||||
login_button.onclick = login;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async getHtml() {
|
async getHtml() {
|
||||||
|
@ -30,14 +30,11 @@ export default class extends AbstractView {
|
|||||||
|
|
||||||
async postInit()
|
async postInit()
|
||||||
{
|
{
|
||||||
let register_button = document.getElementById("button")
|
document.getElementById("button").onclick = register;
|
||||||
if (register_button != null)
|
|
||||||
register_button.onclick = register;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async getHtml() {
|
async getHtml() {
|
||||||
if (client.isAuthentificate())
|
if (await client.isAuthentificate())
|
||||||
{
|
{
|
||||||
navigateTo("/home")
|
navigateTo("/home")
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user