Fix admin panel authentication and navigation for static export
- Replace router.push with window.location.href for reliable redirects - Fix auth check to wait for component mount before accessing localStorage - Ensure proper redirect after successful login - Fix redirect behavior on all admin pages (dashboard, colors, requests)
This commit is contained in:
@@ -32,8 +32,8 @@ export default function AdminLogin() {
|
||||
// Track successful login
|
||||
trackEvent('Admin', 'Login', 'Success');
|
||||
|
||||
// Redirect to admin dashboard
|
||||
router.push('/upadaj/dashboard');
|
||||
// Redirect to admin dashboard using window.location for static export
|
||||
window.location.href = '/upadaj/dashboard';
|
||||
} catch (err: any) {
|
||||
setError('Neispravno korisničko ime ili lozinka');
|
||||
console.error('Login error:', err);
|
||||
|
||||
Reference in New Issue
Block a user