Fix site ID and ntfy topic failing to restore from LocalStorage

Signed-off-by: AKP <tom@tdpain.net>
This commit is contained in:
akp 2022-11-09 12:44:49 +00:00
parent 73bfd8ce8c
commit 5c73978163
No known key found for this signature in database
GPG key ID: AA5726202C8879B7
3 changed files with 19 additions and 13 deletions

View file

@ -23,4 +23,18 @@ function showSuccessElement(elem) {
show(successIndicator)
}
const state = {}
const state = {}
window.onload = () => {
let x = localStorage.getItem("site")
if (x === undefined) {
return
}
siteIDInput.value = x
x = localStorage.getItem("ntfy_topic")
if (x === undefined) {
return
}
ntfyTopicInput.value = x
}

View file

@ -1,8 +1,8 @@
const selectSiteBlock = document.getElementById("select_site");
const siteIDInput = document.getElementById("select_site__site_id_input")
{
const nextButton = document.getElementById("select_site__next_button")
const siteIDInput = document.getElementById("select_site__site_id_input")
siteIDInput.addEventListener("change", () => {
if (siteIDInput.value.trim() === "") {
@ -13,11 +13,7 @@ const selectSiteBlock = document.getElementById("select_site");
})
document.addEventListener("load", () => {
const x = localStorage.getItem("site")
if (x === undefined) {
return
}
siteIDInput.value = x
})
nextButton.addEventListener("click", () => {

View file

@ -1,8 +1,8 @@
const submitBlock = document.getElementById("submit")
const ntfyTopicInput = document.getElementById("submit__ntfy_topic")
{
const nextButton = document.getElementById("submit__next_button")
const ntfyTopicInput = document.getElementById("submit__ntfy_topic")
ntfyTopicInput.addEventListener("change", () => {
if (ntfyTopicInput.value.trim() === "") {
@ -13,11 +13,7 @@ const submitBlock = document.getElementById("submit")
})
document.addEventListener("load", () => {
const x = localStorage.getItem("ntfy_topic")
if (x === undefined) {
return
}
ntfyTopicInput.value = x
})
nextButton.addEventListener("click", () => {