import { client, navigateTo } from "../../index.js"; import AbstractNonAuthentifiedView from "../AbstractNonAuthentified.js"; async function register() { let username = document.getElementById("username").value; let password = document.getElementById("password").value; let response_data = await client.account.create(username, password); if (response_data == null) { navigateTo("/home"); return; } clear("innerHTML", ["username", "user", "password"]); fill_errors(response_data, "innerHTML"); } export default class extends AbstractNonAuthentifiedView { constructor(params) { super(params, "Register", "/home"); } async postInit() { document.getElementById("register-button").onclick = register; } async getHtml() { return `
Login
`; } }