blob: 028601a609336ca014cff424f23214fb2e5efebd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
const loginInfo = document.getElementById("login-info");
const loginForm = document.getElementById("login-page");
window.addEventListener("DOMContentLoaded", () => {
const signInButton = document.getElementById("signInButton");
signInButton.addEventListener("click", () => {
const email = document.getElementById("inputEmail").value;
const password = document.getElementById("inputPassword").value;
firebase
.auth()
.signInWithEmailAndPassword(email, password)
.then((user) => {
window.location.assign("/admin/dashboard");
});
});
firebase.auth().onAuthStateChanged((user) => {
if (user) {
window.location.assign("/admin/dashboard");
} else {
loginForm.classList.remove("hidden");
loginInfo.classList.add("hidden");
}
});
});
|