completionId: cgen-178910797de4486babf1c785b3c4c139
cgen-178910797de4486babf1c785b3c4c139
This commit is contained in:
parent
e8bbedfc83
commit
551cfbba70
4 changed files with 141 additions and 61 deletions
|
|
@ -38,20 +38,41 @@ export default function DevLinkDashboard() {
|
|||
const token = session?.access_token;
|
||||
if (!token) throw new Error("No auth token");
|
||||
|
||||
const profileRes = await fetch(`${API_BASE}/api/devlink/profile`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
if (profileRes.ok) setProfile(await profileRes.json());
|
||||
try {
|
||||
const profileRes = await fetch(`${API_BASE}/api/devlink/profile`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
if (profileRes.ok) {
|
||||
const data = await profileRes.json();
|
||||
setProfile(data);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("Failed to load profile:", err);
|
||||
}
|
||||
|
||||
const oppRes = await fetch(`${API_BASE}/api/devlink/opportunities`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
if (oppRes.ok) setOpportunities(await oppRes.json());
|
||||
try {
|
||||
const oppRes = await fetch(`${API_BASE}/api/devlink/opportunities`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
if (oppRes.ok) {
|
||||
const data = await oppRes.json();
|
||||
setOpportunities(Array.isArray(data) ? data : []);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("Failed to load opportunities:", err);
|
||||
}
|
||||
|
||||
const teamsRes = await fetch(`${API_BASE}/api/devlink/teams`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
if (teamsRes.ok) setTeams(await teamsRes.json());
|
||||
try {
|
||||
const teamsRes = await fetch(`${API_BASE}/api/devlink/teams`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
if (teamsRes.ok) {
|
||||
const data = await teamsRes.json();
|
||||
setTeams(Array.isArray(data) ? data : []);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("Failed to load teams:", err);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Failed to load DEV-LINK data", error);
|
||||
} finally {
|
||||
|
|
|
|||
|
|
@ -58,22 +58,28 @@ export default function FoundationDashboard() {
|
|||
const token = session?.access_token;
|
||||
if (!token) throw new Error("No auth token");
|
||||
|
||||
// Load courses
|
||||
const coursesRes = await fetch(`${API_BASE}/api/foundation/courses`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
if (coursesRes.ok) {
|
||||
const data = await coursesRes.json();
|
||||
setCourses(Array.isArray(data) ? data : []);
|
||||
try {
|
||||
const coursesRes = await fetch(`${API_BASE}/api/foundation/courses`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
if (coursesRes.ok) {
|
||||
const data = await coursesRes.json();
|
||||
setCourses(Array.isArray(data) ? data : []);
|
||||
}
|
||||
} catch (err: any) {
|
||||
console.error("Failed to load courses:", err);
|
||||
}
|
||||
|
||||
// Load mentorships
|
||||
const mentorRes = await fetch(`${API_BASE}/api/foundation/mentorships`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
if (mentorRes.ok) {
|
||||
const data = await mentorRes.json();
|
||||
setMentorships(data.as_mentee || []);
|
||||
try {
|
||||
const mentorRes = await fetch(`${API_BASE}/api/foundation/mentorships`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
if (mentorRes.ok) {
|
||||
const data = await mentorRes.json();
|
||||
setMentorships(data.as_mentee || []);
|
||||
}
|
||||
} catch (err: any) {
|
||||
console.error("Failed to load mentorships:", err);
|
||||
}
|
||||
} catch (error: any) {
|
||||
console.error("Failed to load dashboard data", error);
|
||||
|
|
|
|||
|
|
@ -39,28 +39,53 @@ export default function LabsDashboard() {
|
|||
const token = session?.access_token;
|
||||
if (!token) throw new Error("No auth token");
|
||||
|
||||
const tracksRes = await fetch(`${API_BASE}/api/labs/research-tracks`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
if (tracksRes.ok) setResearchTracks(await tracksRes.json());
|
||||
try {
|
||||
const tracksRes = await fetch(`${API_BASE}/api/labs/research-tracks`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
if (tracksRes.ok) {
|
||||
const data = await tracksRes.json();
|
||||
setResearchTracks(Array.isArray(data) ? data : []);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("Failed to load research tracks:", err);
|
||||
}
|
||||
|
||||
const bountiesRes = await fetch(`${API_BASE}/api/labs/bounties`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
if (bountiesRes.ok) setBounties(await bountiesRes.json());
|
||||
try {
|
||||
const bountiesRes = await fetch(`${API_BASE}/api/labs/bounties`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
if (bountiesRes.ok) {
|
||||
const data = await bountiesRes.json();
|
||||
setBounties(Array.isArray(data) ? data : []);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("Failed to load bounties:", err);
|
||||
}
|
||||
|
||||
const pubRes = await fetch(`${API_BASE}/api/labs/publications`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
if (pubRes.ok) setPublications(await pubRes.json());
|
||||
try {
|
||||
const pubRes = await fetch(`${API_BASE}/api/labs/publications`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
if (pubRes.ok) {
|
||||
const data = await pubRes.json();
|
||||
setPublications(Array.isArray(data) ? data : []);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("Failed to load publications:", err);
|
||||
}
|
||||
|
||||
const ipRes = await fetch(`${API_BASE}/api/labs/ip-portfolio`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
if (ipRes.ok) {
|
||||
const data = await ipRes.json();
|
||||
setIpPortfolio(data);
|
||||
setIsAdmin(data?.is_admin || false);
|
||||
try {
|
||||
const ipRes = await fetch(`${API_BASE}/api/labs/ip-portfolio`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
if (ipRes.ok) {
|
||||
const data = await ipRes.json();
|
||||
setIpPortfolio(data);
|
||||
setIsAdmin(data?.is_admin || false);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("Failed to load IP portfolio:", err);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Failed to load LABS data", error);
|
||||
|
|
|
|||
|
|
@ -39,25 +39,53 @@ export default function StaffDashboard() {
|
|||
const token = session?.access_token;
|
||||
if (!token) throw new Error("No auth token");
|
||||
|
||||
const memberRes = await fetch(`${API_BASE}/api/staff/me`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
if (memberRes.ok) setStaffMember(await memberRes.json());
|
||||
try {
|
||||
const memberRes = await fetch(`${API_BASE}/api/staff/me`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
if (memberRes.ok) {
|
||||
const data = await memberRes.json();
|
||||
setStaffMember(data);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("Failed to load staff member data:", err);
|
||||
}
|
||||
|
||||
const okrRes = await fetch(`${API_BASE}/api/staff/okrs`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
if (okrRes.ok) setOkrs(await okrRes.json());
|
||||
try {
|
||||
const okrRes = await fetch(`${API_BASE}/api/staff/okrs`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
if (okrRes.ok) {
|
||||
const data = await okrRes.json();
|
||||
setOkrs(Array.isArray(data) ? data : []);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("Failed to load OKRs:", err);
|
||||
}
|
||||
|
||||
const invRes = await fetch(`${API_BASE}/api/staff/invoices`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
if (invRes.ok) setInvoices(await invRes.json());
|
||||
try {
|
||||
const invRes = await fetch(`${API_BASE}/api/staff/invoices`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
if (invRes.ok) {
|
||||
const data = await invRes.json();
|
||||
setInvoices(Array.isArray(data) ? data : []);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("Failed to load invoices:", err);
|
||||
}
|
||||
|
||||
const dirRes = await fetch(`${API_BASE}/api/staff/directory`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
if (dirRes.ok) setDirectory(await dirRes.json());
|
||||
try {
|
||||
const dirRes = await fetch(`${API_BASE}/api/staff/directory`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
if (dirRes.ok) {
|
||||
const data = await dirRes.json();
|
||||
setDirectory(Array.isArray(data) ? data : []);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("Failed to load directory:", err);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Failed to load STAFF data", error);
|
||||
} finally {
|
||||
|
|
|
|||
Loading…
Reference in a new issue