diff --git a/src/clients/Transparency.ts b/src/clients/Transparency.ts index fb82a1a96..e2c76bce0 100644 --- a/src/clients/Transparency.ts +++ b/src/clients/Transparency.ts @@ -52,6 +52,10 @@ export type TransparencyBudget = { category_percentages: Record } +export type TransparencyTeams = { + committees: Committee[] +} + const EMPTY_API: TransparencyData = { balances: [], income: { @@ -93,4 +97,16 @@ export class Transparency { return [] } } + + static async getTeams() { + try { + const response = (await (await fetch(`${API_URL}/teams.json`)).json()) as TransparencyTeams + return response + } catch (error) { + ErrorClient.report('Failed to fetch transparency data', { error, category: ErrorCategory.Transparency }) + return { + committees: [], + } + } + } } diff --git a/src/entities/Committee/utils.ts b/src/entities/Committee/utils.ts index 2ada61887..4add11b73 100644 --- a/src/entities/Committee/utils.ts +++ b/src/entities/Committee/utils.ts @@ -1,7 +1,7 @@ import { Committee, CommitteeName, Transparency } from '../../clients/Transparency' export async function getCommitteesWithOpenSlots(): Promise { - const { committees } = await Transparency.getData() + const { committees } = await Transparency.getTeams() return committees.filter((committee) => committee.size > committee.members.length) }