wirm/Web/public/js/ebcd-common-navbar.js
2025-02-11 11:09:26 +08:00

20 lines
693 B
JavaScript

import { app, auth } from "./ebcd-common-firebase.js";
// the navbar has the following li elements in a dropdown:
// - nav-auth-logIn
// - nav-auth-signUp
// - nav-auth-profile
// - nav-auth-logOut
// are we logged in?
auth.onAuthStateChanged((user) => {
if (user) {
// signed in, only show the profile and log out links
document.getElementById("nav-auth-logIn").style.display = "none";
document.getElementById("nav-auth-signUp").style.display = "none";
} else {
// not signed in, only show the log in and sign up links
document.getElementById("nav-auth-profile").style.display = "none";
document.getElementById("nav-auth-logOut").style.display = "none";
}
});