fixed some state-bugs
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
<title>Slop Farmer</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="signup" style="visibility: collapse;"
|
||||
<div id="signup" style="visibility: collapse;">
|
||||
<form id="signup-form">
|
||||
<label for="email">email</label>
|
||||
<input type="email" name="email" required />
|
||||
|
||||
@@ -10,6 +10,7 @@ class PopupState {
|
||||
this.logged_in = logged_in
|
||||
this.page_sections = page_sections
|
||||
this.visible_section = visible_section
|
||||
this.setVisibleSection(visible_section)
|
||||
}
|
||||
|
||||
setVisibleSection(section_id: string) {
|
||||
@@ -20,14 +21,6 @@ class PopupState {
|
||||
}
|
||||
}
|
||||
|
||||
if (localStorage.getItem("accessToken")) {
|
||||
login_status.setAttribute("style", "visibility: visible;")
|
||||
}
|
||||
|
||||
login_form.addEventListener("submit", (event) => { event.preventDefault(); submit_login_form() })
|
||||
|
||||
signup_form.addEventListener("submit", (event) => { event.preventDefault(); submit_signup_form() })
|
||||
|
||||
async function submit_login_form() {
|
||||
|
||||
const login_url = new URL("/login", API_URL)
|
||||
@@ -84,5 +77,13 @@ function initialize_popup() {
|
||||
page_sections.set("login", login_section)
|
||||
page_sections.set("report", report_section)
|
||||
|
||||
const popup_state = new PopupState(false, page_sections, "signup_section")
|
||||
}
|
||||
const popup_state = new PopupState(false, page_sections, "signup")
|
||||
|
||||
login_form.addEventListener("submit", (event) => { event.preventDefault(); submit_login_form() })
|
||||
|
||||
signup_form.addEventListener("submit", (event) => { event.preventDefault(); submit_signup_form() })
|
||||
}
|
||||
|
||||
addEventListener("DOMContentLoaded", (event) => {
|
||||
initialize_popup()
|
||||
})
|
||||
Reference in New Issue
Block a user