2025-04-30 05:01:03 +02:00

30 lines
745 B
JavaScript

const loginchoice = document.querySelector("main > article.loginchoice")
function selectLoginType(type) {
for (const frame of loginchoice.children) {
frame.setAttribute("hidden", "")
if (frame.getAttribute("frame") == type) {
frame.removeAttribute("hidden")
}
}
if (type == "microsoft") {
system.call(`auth::${type}`)
}
}
system.result("auth::microsoft", () => {
selectLoginType("select")
})
system.result("auth::refresh", () => {
selectLoginType("select")
})
window.onload = () => {
if (localStorage.getItem("user")) {
system.call("auth::refresh", {
user: JSON.parse(localStorage.getItem("user"))
})
selectLoginType("token")
}
}