A frontend for your PDS
1import { Config } from "../../config";
2
3const getHeatmapData = async (): Promise<Record<string, number>> => {
4 try {
5 const response = await fetch(`${Config.TCAPI_URL}/pds/blueskyHeatmap`);
6 if (!response.ok) {
7 throw new Error(`Failed to fetch heatmap data: ${response.status}`);
8 }
9 const data = await response.json();
10 return data;
11 } catch (error) {
12 console.error("Error fetching heatmap data:", error);
13 throw error;
14 }
15};
16
17const getContributors = async (): Promise<any[]> => {
18 try {
19 const response = await fetch(`https://api.github.com/repos/${Config.GITHUB_REPO_OWNER}/${Config.GITHUB_REPO_NAME}/contributors`);
20 if (!response.ok) {
21 throw new Error(`Failed to fetch contributors: ${response.status}`);
22 }
23 const data = await response.json();
24 return data;
25 } catch (error) {
26 console.error("Error fetching contributors:", error);
27 throw error;
28 }
29}
30
31export { getHeatmapData, getContributors };