-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhome.js
23 lines (21 loc) · 970 Bytes
/
home.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Check login status on page load
document.addEventListener("DOMContentLoaded", function() {
const isLoggedIn = sessionStorage.getItem("isLoggedIn");
const welcomeContainer = document.getElementById("welcome-container");
const welcomeMessage = document.getElementById("welcome-message");
const getStartedButton = document.getElementById("get-started-button");
if (isLoggedIn === "true") {
// Show welcome message and logout button, hide Get Started button
welcomeContainer.style.display = "block";
welcomeMessage.textContent = "Welcome to LogiTrack!";
getStartedButton.style.display = "none";
} else {
// Show Get Started button if not logged in
getStartedButton.style.display = "block";
}
});
// Logout function to clear session and reload page
function logout() {
sessionStorage.removeItem("isLoggedIn");
window.location.reload(); // Reload to apply changes
}