Sync
This commit is contained in:
30
app/assets/js/login.js
Normal file
30
app/assets/js/login.js
Normal file
@@ -0,0 +1,30 @@
|
||||
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")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user