🚀 مُصادَق: تحديث برمجي جديد 2026-05-03 01:13
This commit is contained in:
@@ -96,12 +96,18 @@
|
||||
window.onpopstate = () => this.navigate(window.location.pathname);
|
||||
},
|
||||
async navigate(path) {
|
||||
if (path === '/login' || !this.isLoggedIn) {
|
||||
// Handle subdirectories and index.php in the path
|
||||
const isLogin = path.includes('/login');
|
||||
const isDashboard = path.includes('/dashboard') || path.endsWith('/') || path.endsWith('index.php');
|
||||
|
||||
if (isLogin || !this.isLoggedIn) {
|
||||
this.pageHtml = await this.loadPage('login');
|
||||
window.history.pushState({}, '', '/login');
|
||||
} else if (path === '/' || path === '/dashboard') {
|
||||
if (!path.includes('/login')) window.history.pushState({}, '', 'login');
|
||||
} else if (isDashboard) {
|
||||
this.pageHtml = await this.loadPage('dashboard');
|
||||
window.history.pushState({}, '', '/dashboard');
|
||||
if (!path.includes('/dashboard')) window.history.pushState({}, '', 'dashboard');
|
||||
} else {
|
||||
this.pageHtml = await this.loadPage('dashboard'); // Default
|
||||
}
|
||||
},
|
||||
initCharts() {
|
||||
|
||||
Reference in New Issue
Block a user