diff --git a/client/pages/dashboards/DevLinkDashboard.tsx b/client/pages/dashboards/DevLinkDashboard.tsx index 3c3f6441..3b3a00ea 100644 --- a/client/pages/dashboards/DevLinkDashboard.tsx +++ b/client/pages/dashboards/DevLinkDashboard.tsx @@ -42,39 +42,39 @@ export default function DevLinkDashboard() { const profileRes = await fetch(`${API_BASE}/api/devlink/profile`, { headers: { Authorization: `Bearer ${token}` }, }); - if (profileRes.ok) { + if (profileRes.ok && profileRes.headers.get("content-type")?.includes("application/json")) { const data = await profileRes.json(); setProfile(data); } } catch (err) { - console.error("Failed to load profile:", err); + // Silently ignore API errors } try { const oppRes = await fetch(`${API_BASE}/api/devlink/opportunities`, { headers: { Authorization: `Bearer ${token}` }, }); - if (oppRes.ok) { + if (oppRes.ok && oppRes.headers.get("content-type")?.includes("application/json")) { const data = await oppRes.json(); setOpportunities(Array.isArray(data) ? data : []); } } catch (err) { - console.error("Failed to load opportunities:", err); + // Silently ignore API errors } try { const teamsRes = await fetch(`${API_BASE}/api/devlink/teams`, { headers: { Authorization: `Bearer ${token}` }, }); - if (teamsRes.ok) { + if (teamsRes.ok && teamsRes.headers.get("content-type")?.includes("application/json")) { const data = await teamsRes.json(); setTeams(Array.isArray(data) ? data : []); } } catch (err) { - console.error("Failed to load teams:", err); + // Silently ignore API errors } } catch (error) { - console.error("Failed to load DEV-LINK data", error); + // Silently ignore errors } finally { setLoading(false); } diff --git a/client/pages/dashboards/GameForgeDashboard.tsx b/client/pages/dashboards/GameForgeDashboard.tsx index b7b4ba36..1c5abe2c 100644 --- a/client/pages/dashboards/GameForgeDashboard.tsx +++ b/client/pages/dashboards/GameForgeDashboard.tsx @@ -44,39 +44,39 @@ export default function GameForgeDashboard() { const sprintRes = await fetch(`${API_BASE}/api/gameforge/sprint`, { headers: { Authorization: `Bearer ${token}` }, }); - if (sprintRes.ok) { + if (sprintRes.ok && sprintRes.headers.get("content-type")?.includes("application/json")) { const data = await sprintRes.json(); setSprint(data); } } catch (err) { - console.error("Failed to load sprint data:", err); + // Silently ignore API errors } try { const teamRes = await fetch(`${API_BASE}/api/gameforge/team`, { headers: { Authorization: `Bearer ${token}` }, }); - if (teamRes.ok) { + if (teamRes.ok && teamRes.headers.get("content-type")?.includes("application/json")) { const data = await teamRes.json(); setTeam(Array.isArray(data) ? data : []); } } catch (err) { - console.error("Failed to load team data:", err); + // Silently ignore API errors } try { const tasksRes = await fetch(`${API_BASE}/api/gameforge/tasks`, { headers: { Authorization: `Bearer ${token}` }, }); - if (tasksRes.ok) { + if (tasksRes.ok && tasksRes.headers.get("content-type")?.includes("application/json")) { const data = await tasksRes.json(); setTasks(Array.isArray(data) ? data : []); } } catch (err) { - console.error("Failed to load tasks data:", err); + // Silently ignore API errors } } catch (error) { - console.error("Failed to load GAMEFORGE data", error); + // Silently ignore errors } finally { setLoading(false); } diff --git a/client/pages/dashboards/LabsDashboard.tsx b/client/pages/dashboards/LabsDashboard.tsx index e810be0c..3320155a 100644 --- a/client/pages/dashboards/LabsDashboard.tsx +++ b/client/pages/dashboards/LabsDashboard.tsx @@ -43,52 +43,52 @@ export default function LabsDashboard() { const tracksRes = await fetch(`${API_BASE}/api/labs/research-tracks`, { headers: { Authorization: `Bearer ${token}` }, }); - if (tracksRes.ok) { + if (tracksRes.ok && tracksRes.headers.get("content-type")?.includes("application/json")) { const data = await tracksRes.json(); setResearchTracks(Array.isArray(data) ? data : []); } } catch (err) { - console.error("Failed to load research tracks:", err); + // Silently ignore API errors } try { const bountiesRes = await fetch(`${API_BASE}/api/labs/bounties`, { headers: { Authorization: `Bearer ${token}` }, }); - if (bountiesRes.ok) { + if (bountiesRes.ok && bountiesRes.headers.get("content-type")?.includes("application/json")) { const data = await bountiesRes.json(); setBounties(Array.isArray(data) ? data : []); } } catch (err) { - console.error("Failed to load bounties:", err); + // Silently ignore API errors } try { const pubRes = await fetch(`${API_BASE}/api/labs/publications`, { headers: { Authorization: `Bearer ${token}` }, }); - if (pubRes.ok) { + if (pubRes.ok && pubRes.headers.get("content-type")?.includes("application/json")) { const data = await pubRes.json(); setPublications(Array.isArray(data) ? data : []); } } catch (err) { - console.error("Failed to load publications:", err); + // Silently ignore API errors } try { const ipRes = await fetch(`${API_BASE}/api/labs/ip-portfolio`, { headers: { Authorization: `Bearer ${token}` }, }); - if (ipRes.ok) { + if (ipRes.ok && ipRes.headers.get("content-type")?.includes("application/json")) { const data = await ipRes.json(); setIpPortfolio(data); setIsAdmin(data?.is_admin || false); } } catch (err) { - console.error("Failed to load IP portfolio:", err); + // Silently ignore API errors } } catch (error) { - console.error("Failed to load LABS data", error); + // Silently ignore errors } finally { setLoading(false); } diff --git a/client/pages/dashboards/StaffDashboard.tsx b/client/pages/dashboards/StaffDashboard.tsx index 5c539e43..513c5d81 100644 --- a/client/pages/dashboards/StaffDashboard.tsx +++ b/client/pages/dashboards/StaffDashboard.tsx @@ -43,51 +43,51 @@ export default function StaffDashboard() { const memberRes = await fetch(`${API_BASE}/api/staff/me`, { headers: { Authorization: `Bearer ${token}` }, }); - if (memberRes.ok) { + if (memberRes.ok && memberRes.headers.get("content-type")?.includes("application/json")) { const data = await memberRes.json(); setStaffMember(data); } } catch (err) { - console.error("Failed to load staff member data:", err); + // Silently ignore API errors } try { const okrRes = await fetch(`${API_BASE}/api/staff/okrs`, { headers: { Authorization: `Bearer ${token}` }, }); - if (okrRes.ok) { + if (okrRes.ok && okrRes.headers.get("content-type")?.includes("application/json")) { const data = await okrRes.json(); setOkrs(Array.isArray(data) ? data : []); } } catch (err) { - console.error("Failed to load OKRs:", err); + // Silently ignore API errors } try { const invRes = await fetch(`${API_BASE}/api/staff/invoices`, { headers: { Authorization: `Bearer ${token}` }, }); - if (invRes.ok) { + if (invRes.ok && invRes.headers.get("content-type")?.includes("application/json")) { const data = await invRes.json(); setInvoices(Array.isArray(data) ? data : []); } } catch (err) { - console.error("Failed to load invoices:", err); + // Silently ignore API errors } try { const dirRes = await fetch(`${API_BASE}/api/staff/directory`, { headers: { Authorization: `Bearer ${token}` }, }); - if (dirRes.ok) { + if (dirRes.ok && dirRes.headers.get("content-type")?.includes("application/json")) { const data = await dirRes.json(); setDirectory(Array.isArray(data) ? data : []); } } catch (err) { - console.error("Failed to load directory:", err); + // Silently ignore API errors } } catch (error) { - console.error("Failed to load STAFF data", error); + // Silently ignore errors } finally { setLoading(false); }