diff options
Diffstat (limited to 'frontend/pwmodal.ts')
-rw-r--r-- | frontend/pwmodal.ts | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/frontend/pwmodal.ts b/frontend/pwmodal.ts index a20a79f..485896a 100644 --- a/frontend/pwmodal.ts +++ b/frontend/pwmodal.ts @@ -1,25 +1,21 @@ import { e } from "./helper.ts" -import { tryLoadAdminPanel } from "./admin.ts" +import { try_load_admin_panel } from "./admin.ts" export function pw_modal() { - const inp_name = e("input", {type: "text", placeholder: "Username"}) - const inp_pw = e("input", {type: "password", placeholder: "Password"}) - const error_msg = e("span", {class: "error-msg"}, "") - const login_btn = e("button", { - onclick: ev => { - ev.preventDefault() - tryLoadAdminPanel(inp_name.value, inp_pw.value).catch(err => { - error_msg.textContent = err - }) - } - }, "Login") - + let inp_name: HTMLInputElement, inp_pw: HTMLInputElement, error_msg: HTMLSpanElement; return e("dialog", {}, - e("form", {method: "dialog"}, - inp_name, - inp_pw, - login_btn, - error_msg, + e("form", { method: "dialog" }, + inp_name = e("input", { type: "text", placeholder: "Username" }), + inp_pw = e("input", { type: "password", placeholder: "Password" }), + e("button", { + onclick: ev => { + ev.preventDefault() + try_load_admin_panel(inp_name.value, inp_pw.value).catch(err => { + error_msg.textContent = err + }) + } + }, "Login"), + error_msg = e("span", { class: "error-msg" }, ""), ) ) } |