Skip to content

Commit 8a9c1f6

Browse files
committed
Update APIs
1 parent 6996d5a commit 8a9c1f6

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

components/Page/Sponsors.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const Sponsors: React.FunctionComponent<ISponsorsProps> = (props: React.P
1414

1515
useEffect(() => {
1616
const getSponsors = async () => {
17-
const response = await fetch(`${CONFIG.urls.api}/api/sponsors`);
17+
const response = await fetch(`${CONFIG.urls.api}${CONFIG.api.sponsors}`);
1818

1919
if (!response.ok) {
2020
setIndividuals(null);

constants/config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ export const CONFIG = {
55
preview: "https://cloudflare.front-matter-docs.pages.dev",
66
local: "http://localhost:3000",
77
},
8+
api: {
9+
sponsors: "/sponsors",
10+
stats: "/stats",
11+
stars: "/stars",
12+
},
813
environment: process.env.NEXT_PUBLIC_VERCEL_ENV,
914
github: {
1015
token: process.env.GITHUB_AUTH,

pages/analytics/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const Charts = () => {
1616
const [stats, setStats] = useState<Analytics | null>(null);
1717

1818
const getStats = async () => {
19-
const res = await fetch(`${CONFIG.urls.api}/api/stats`);
19+
const res = await fetch(`${CONFIG.urls.api}${CONFIG.api.stats}`);
2020
const json = await res.json();
2121
setStats(json);
2222
};

services/StarService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export class StarService {
1010
}
1111

1212
if (!StarService.starCaller) {
13-
StarService.starCaller = fetch(`${CONFIG.urls.api}/api/stars`);
13+
StarService.starCaller = fetch(`${CONFIG.urls.api}${CONFIG.api.stars}`);
1414
}
1515

1616
const response = await StarService.starCaller;

0 commit comments

Comments
 (0)