Skip to content

Commit

Permalink
endow balance fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
ap-justin committed Jan 24, 2025
1 parent 2dc4ed3 commit 418f089
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/api/get/endow-balance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,20 @@ import { apes, ver } from "../api";

export async function getEndowBalance(idParam: string | undefined) {
const id = parse(plusInt, idParam);
return apes.get<EndowmentBalances>(`${ver(1)}/balances/${id}`).json();
const res = await apes.get<EndowmentBalances>(`${ver(1)}/balances/${id}`, {
throwHttpErrors: false,
});
if (!res.ok) {
return {
contributionsCount: 0,
donationsBal: 0,
payoutsMade: 0,
payoutsPending: 0,
sustainabilityFundBal: 0,
totalContributions: 0,
totalEarnings: 0,
};
}

return res.json();
}

0 comments on commit 418f089

Please sign in to comment.