completionId: cgen-ff03c07ab89b48d69025a26448158af4

cgen-ff03c07ab89b48d69025a26448158af4
This commit is contained in:
Builder.io 2025-11-15 16:31:38 +00:00
parent 551cfbba70
commit a71ad8cf3e

View file

@ -62,27 +62,27 @@ export default function FoundationDashboard() {
const coursesRes = await fetch(`${API_BASE}/api/foundation/courses`, {
headers: { Authorization: `Bearer ${token}` },
});
if (coursesRes.ok) {
if (coursesRes.ok && coursesRes.headers.get("content-type")?.includes("application/json")) {
const data = await coursesRes.json();
setCourses(Array.isArray(data) ? data : []);
}
} catch (err: any) {
console.error("Failed to load courses:", err);
// Silently ignore API errors - dashboard will render with empty data
}
try {
const mentorRes = await fetch(`${API_BASE}/api/foundation/mentorships`, {
headers: { Authorization: `Bearer ${token}` },
});
if (mentorRes.ok) {
if (mentorRes.ok && mentorRes.headers.get("content-type")?.includes("application/json")) {
const data = await mentorRes.json();
setMentorships(data.as_mentee || []);
}
} catch (err: any) {
console.error("Failed to load mentorships:", err);
// Silently ignore API errors - dashboard will render with empty data
}
} catch (error: any) {
console.error("Failed to load dashboard data", error);
// Silently ignore errors
} finally {
setLoading(false);
}