diff --git a/frontend/src/pages/Settings/Status.tsx b/frontend/src/pages/Settings/Status.tsx index ad658edb..6806782b 100644 --- a/frontend/src/pages/Settings/Status.tsx +++ b/frontend/src/pages/Settings/Status.tsx @@ -275,7 +275,7 @@ export default function Status() { {/* Module Statistics */} - +
{/* Planner Module */}
@@ -359,11 +359,28 @@ function APIMonitoringCard() { const controller = new AbortController(); const timeoutId = setTimeout(() => controller.abort(), 10000); // 10 second timeout + // Get auth token if available (for endpoints that require auth) + const headers: HeadersInit = { + 'Content-Type': 'application/json', + }; + + // Try to get JWT token from localStorage for authenticated endpoints + try { + const authStorage = localStorage.getItem('auth-storage'); + if (authStorage) { + const parsed = JSON.parse(authStorage); + const token = parsed?.state?.token; + if (token) { + headers['Authorization'] = `Bearer ${token}`; + } + } + } catch (e) { + // Ignore errors getting token + } + const response = await fetch(`${API_BASE_URL}${endpoint.endpoint}`, { method: 'GET', - headers: { - 'Content-Type': 'application/json', - }, + headers, credentials: 'include', signal: controller.signal, }); @@ -374,13 +391,29 @@ function APIMonitoringCard() { // Determine status based on response time and status code let status: 'healthy' | 'warning' | 'critical' = 'healthy'; + + // 401/403 for auth endpoints is normal (endpoint works, just needs auth) + const isAuthEndpoint = endpoint.endpoint.includes('/auth/') || + endpoint.endpoint.includes('/me/'); + if (response.status >= 500) { + // Server errors are critical status = 'critical'; - } else if (response.status >= 400 || responseTime > 2000) { + } else if (response.status === 401 || response.status === 403) { + // Auth errors are healthy for auth endpoints (endpoint is working) + // For other endpoints, it's a warning (endpoint works but access denied) + status = isAuthEndpoint ? 'healthy' : 'warning'; + } else if (response.status >= 400) { + // Other 4xx errors are warnings (client errors, but endpoint responds) status = 'warning'; + } else if (responseTime > 2000) { + // Very slow responses are critical + status = 'critical'; } else if (responseTime > 1000) { + // Slow responses are warnings status = 'warning'; } + // Otherwise healthy (200-299, fast response) return { ...endpoint,