aboutsummaryrefslogtreecommitdiff
path: root/static/assets/js/pages/admin.js
diff options
context:
space:
mode:
Diffstat (limited to 'static/assets/js/pages/admin.js')
-rw-r--r--static/assets/js/pages/admin.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/static/assets/js/pages/admin.js b/static/assets/js/pages/admin.js
new file mode 100644
index 0000000..5f88cfc
--- /dev/null
+++ b/static/assets/js/pages/admin.js
@@ -0,0 +1,28 @@
+window.addEventListener("DOMContentLoaded", () => {
+ const firebaseConfig = {
+ apiKey: "AIzaSyBCmKUnEmm8hLR9ZcFWPYbYiplbP6yUzfU",
+ authDomain: "thatcomputerscientist-e9cf2.firebaseapp.com",
+ projectId: "thatcomputerscientist-e9cf2",
+ storageBucket: "thatcomputerscientist-e9cf2.appspot.com",
+ messagingSenderId: "178402875544",
+ appId: "1:178402875544:web:8c9d8880d3ef495a5658ed",
+ measurementId: "G-JECWWZG5J6",
+ };
+ firebase.initializeApp(firebaseConfig);
+ 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");
+ }
+ });
+});