import { client, navigateTo } from "../../index.js"; import { clear, fill_errors } from "../../utils/formUtils.js"; import AbstractNonAuthentifiedView from "../AbstractNonAuthentified.js"; async function register() { let username = document.getElementById("username-input").value; let password = document.getElementById("password-input").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 `
`; } }