Skip to content

Commit 1aa6fc0

Browse files
committed
fix: client and server caches
1 parent 783b0a6 commit 1aa6fc0

File tree

14 files changed

+660
-627
lines changed

14 files changed

+660
-627
lines changed

src/api/client.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import {Contributor} from './types';
2+
3+
export class ClientApi {
4+
private static _instance: ClientApi;
5+
6+
static get instance(): ClientApi {
7+
if (!ClientApi._instance) {
8+
ClientApi._instance = new ClientApi();
9+
}
10+
11+
return ClientApi._instance;
12+
}
13+
14+
async fetchAllContributors(): Promise<Contributor[]> {
15+
const res = await fetch('api/contributors');
16+
17+
if (!res.ok) {
18+
return [];
19+
}
20+
21+
return (await res.json())?.contributors || [];
22+
}
23+
}

0 commit comments

Comments
 (0)