Fix ERR_TOO_MANY_REDIRECTS: hapus public/index.php dan tambah guard untuk prevent redirect loop

This commit is contained in:
mwpn
2025-12-18 11:34:20 +07:00
parent 90d0d1a761
commit 28ddcc71ff
6 changed files with 17 additions and 9 deletions

View File

@@ -75,7 +75,9 @@ async function handleLoginSubmit(event) {
document.addEventListener('DOMContentLoaded', () => {
const form = document.getElementById('login-form');
if (form) {
if (Auth.isAuthenticated()) {
// Cek apakah sudah authenticated dan belum di dashboard untuk menghindari redirect loop
const currentPath = window.location.pathname;
if (Auth.isAuthenticated() && !currentPath.includes('dashboard')) {
window.location.href = 'dashboard.html';
return;
}