fix: move code to not render html when not needed

This commit is contained in:
starnakin 2023-11-29 16:10:55 +01:00
parent 6dc0293455
commit d5e692449b
2 changed files with 13 additions and 8 deletions

View File

@ -35,15 +35,17 @@ export default class extends AbstractView {
async postInit() async postInit()
{ {
let login_button = document.getElementById("button")
if (login_button != null)
login_button.onclick = login;
}
async getHtml() {
if (await client.isAuthentificate()) if (await client.isAuthentificate())
{ {
navigateTo("/home") navigateTo("/home")
return; return;
} }
document.getElementById("button").onclick = login;
}
async getHtml() {
return ` return `
<div class=form> <div class=form>
<label>Login</label> <label>Login</label>

View File

@ -30,15 +30,18 @@ export default class extends AbstractView {
async postInit() async postInit()
{ {
let register_button = document.getElementById("button")
if (register_button != null)
register_button.onclick = register;
}
async getHtml() {
if (client.isAuthentificate()) if (client.isAuthentificate())
{ {
navigateTo("/home") navigateTo("/home")
return; return;
} }
document.getElementById("button").onclick = register;
}
async getHtml() {
return ` return `
<div class=form> <div class=form>
<label>Register</label> <label>Register</label>