Skip to content

Commit

Permalink
Merge pull request aditya-bhaumik#895 from aditya-bhaumik/revert-881-…
Browse files Browse the repository at this point in the history
…main

Revert "fix/navigate to home page after successful login"
  • Loading branch information
aditya-bhaumik authored Oct 20, 2024
2 parents b4e55ec + a4d1f62 commit 06505cf
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 27 deletions.
2 changes: 1 addition & 1 deletion components/Navbar/Navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<li class="tab"><a href="/pages/faqs/faqs.html">FAQs</a></li>
<li class="tab"><a href="/pages/blog/blog.html">Blog</a></li>
<li class="tab">
<a id="login" href="/pages/login-signup/login-signup.html">
<a href="/pages/login-signup/login-signup.html">
<i class="fa-solid fa-sign-in-alt"></i> Login
</a>
</li>
Expand Down
24 changes: 0 additions & 24 deletions components/Navbar/Navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,3 @@ icon.onclick = function () {
localStorage.setItem("theme", "light");
}
};

let ele = document.querySelectorAll("a")

for (let i = 0 ;i < ele.length ; i++){
ele[i].onclick = function (){
// console.log(ele[i])

let isLoggedIn = localStorage.getItem("isLoggedIn")

if(isLoggedIn === 'false' || !isLoggedIn) {
ele[i].href = "/pages/login-signup/login-signup.html";
}else{
let login = document.getElementById("login");
login.href = login.baseURI
}

// console.log(ele[i])

};
}




2 changes: 0 additions & 2 deletions pages/login-signup/login-signup.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ document.getElementById('login-form').addEventListener('submit', async (event) =
successMessage.style.transition = 'opacity 0.5s';
}, 50);
localStorage.setItem('isLoggedIn', 'true'); // Store login status
window.location.href = 'index.html'
setTimeout(() => {
successMessage.style.display = 'none';
const urlParams = new URLSearchParams(window.location.search);
Expand Down Expand Up @@ -116,7 +115,6 @@ document.getElementById('signup-form').addEventListener('submit', async (event)
signupBtn.disabled = true;
signupBtn.textContent = 'Signing up...';
console.log('Signup submitted');
localStorage.setItem('isLoggedIn', 'true');
setTimeout(() => {
signupBtn.disabled = false;
signupBtn.textContent = 'Sign Up';
Expand Down

0 comments on commit 06505cf

Please sign in to comment.