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:
@@ -40,9 +40,9 @@ export default function ColorRequestsAdmin() {
|
||||
const checkAuth = () => {
|
||||
const token = localStorage.getItem('authToken');
|
||||
const expiry = localStorage.getItem('tokenExpiry');
|
||||
|
||||
|
||||
if (!token || !expiry || new Date().getTime() > parseInt(expiry)) {
|
||||
router.push('/upadaj');
|
||||
window.location.href = '/upadaj';
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user