Fix dashboard authentication and routing issues
- Fix NODE_ENV=production cookie security issue for local development - Add production API URL configuration (.env.production) - Enable SPA routing with serve -s flag for frontend - Fix React hooks violation in DashboardPage (error #310) - Move useQuery hooks before conditional returns - Rebuild frontend with all fixes applied Resolves dashboard 401 errors, 404 routing issues, and React error #310
This commit is contained in:
1
apps/web/.env.production
Normal file
1
apps/web/.env.production
Normal file
@@ -0,0 +1 @@
|
||||
VITE_API_URL=https://api.urltrackertool.com
|
||||
430
apps/web/dist/assets/index-DhEjB2de.js
vendored
430
apps/web/dist/assets/index-DhEjB2de.js
vendored
File diff suppressed because one or more lines are too long
430
apps/web/dist/assets/index-Z8hwuOIA.js
vendored
Normal file
430
apps/web/dist/assets/index-Z8hwuOIA.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
apps/web/dist/index.html
vendored
2
apps/web/dist/index.html
vendored
@@ -15,7 +15,7 @@
|
||||
|
||||
gtag('config', 'G-ZDZ26XYN2P');
|
||||
</script>
|
||||
<script type="module" crossorigin src="/assets/index-DhEjB2de.js"></script>
|
||||
<script type="module" crossorigin src="/assets/index-Z8hwuOIA.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
||||
@@ -85,22 +85,6 @@ export function DashboardPage() {
|
||||
const cardBg = useColorModeValue('white', 'gray.800');
|
||||
const borderColor = useColorModeValue('gray.200', 'gray.700');
|
||||
|
||||
if (!isAuthenticated) {
|
||||
return (
|
||||
<Container maxW="md">
|
||||
<VStack spacing={6}>
|
||||
<Alert status="warning">
|
||||
<AlertIcon />
|
||||
Please sign in to access your dashboard
|
||||
</Alert>
|
||||
<Button as={RouterLink} to="/login" colorScheme="brand">
|
||||
Sign In
|
||||
</Button>
|
||||
</VStack>
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
|
||||
// Fetch recent checks (only when authenticated)
|
||||
const {
|
||||
data: recentChecks = [],
|
||||
@@ -127,6 +111,22 @@ export function DashboardPage() {
|
||||
enabled: isAuthenticated, // Only run when authenticated
|
||||
});
|
||||
|
||||
if (!isAuthenticated) {
|
||||
return (
|
||||
<Container maxW="md">
|
||||
<VStack spacing={6}>
|
||||
<Alert status="warning">
|
||||
<AlertIcon />
|
||||
Please sign in to access your dashboard
|
||||
</Alert>
|
||||
<Button as={RouterLink} to="/login" colorScheme="brand">
|
||||
Sign In
|
||||
</Button>
|
||||
</VStack>
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
|
||||
// Calculate dashboard metrics
|
||||
const dashboardMetrics = {
|
||||
totalChecks: recentChecks.length,
|
||||
|
||||
Reference in New Issue
Block a user