Skip to content

Commit 12d692d

Browse files
committed
refactor: standardize API endpoint names to lowercase
1 parent 77edcff commit 12d692d

File tree

9 files changed

+16
-17
lines changed

9 files changed

+16
-17
lines changed

api/src/app/endpoints.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ import { SearchResponse } from "src/search/types";
2121

2222
// ts-prune-ignore-next
2323
export interface Endpoints {
24-
// @TODO-ZM: lower case the endpoints, curtesy of @Fcmam5
25-
"api:Projects": {
24+
"api:projects": {
2625
response: GetProjectsResponse;
2726
};
2827
"api:projects/for-sitemap": {
@@ -32,14 +31,14 @@ export interface Endpoints {
3231
response: GetProjectNameResponse;
3332
params: { id: string };
3433
};
35-
"api:Projects/:id": {
34+
"api:projects/:id": {
3635
response: GetProjectResponse;
3736
params: { id: string };
3837
};
39-
"api:Contributions": {
38+
"api:contributions": {
4039
response: GetContributionsResponse;
4140
};
42-
"api:Contributions/:id": {
41+
"api:contributions/:id": {
4342
response: GetContributionResponse;
4443
params: { id: string };
4544
};
@@ -50,24 +49,24 @@ export interface Endpoints {
5049
"api:contributions/for-sitemap": {
5150
response: GetContributionsForSitemapResponse;
5251
};
53-
"api:Contributors": {
52+
"api:contributors": {
5453
response: GetContributorsResponse;
5554
};
5655
"api:contributors/for-sitemap": {
5756
response: GetContributorsForSitemapResponse;
5857
};
59-
"api:Contributors/:id": {
58+
"api:contributors/:id": {
6059
response: GetContributorResponse;
6160
params: { id: string };
6261
};
6362
"api:contributors/:id/name": {
6463
response: GetContributorNameResponse;
6564
params: { id: string };
6665
};
67-
"api:MileStones/dzcode": {
66+
"api:milestones/dzcode": {
6867
response: GetMilestonesResponse;
6968
};
70-
"api:Search": {
69+
"api:search": {
7170
response: SearchResponse;
7271
query: [["query", string], ["limit", number]];
7372
};

web/src/redux/actions/contribution.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const fetchContributionAction =
1313
}
1414
try {
1515
dispatch(contributionPageSlice.actions.set({ contribution: null }));
16-
const { contribution } = await fetchV2("api:Contributions/:id", { params: { id } });
16+
const { contribution } = await fetchV2("api:contributions/:id", { params: { id } });
1717
dispatch(contributionPageSlice.actions.set({ contribution }));
1818
} catch (error) {
1919
dispatch(contributionPageSlice.actions.set({ contribution: "ERROR" }));

web/src/redux/actions/contributions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const fetchContributionsListAction =
88
(): ThunkAction<void, AppState, unknown, Action> => async (dispatch) => {
99
try {
1010
dispatch(contributionsPageSlice.actions.set({ contributionsList: null }));
11-
const { contributions } = await fetchV2("api:Contributions", {});
11+
const { contributions } = await fetchV2("api:contributions", {});
1212

1313
dispatch(contributionsPageSlice.actions.set({ contributionsList: contributions }));
1414
} catch (error) {

web/src/redux/actions/contributor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const fetchContributorAction =
1313
}
1414
try {
1515
dispatch(contributorPageSlice.actions.set({ contributor: null }));
16-
const { contributor } = await fetchV2("api:Contributors/:id", { params: { id } });
16+
const { contributor } = await fetchV2("api:contributors/:id", { params: { id } });
1717
dispatch(contributorPageSlice.actions.set({ contributor }));
1818
} catch (error) {
1919
dispatch(contributorPageSlice.actions.set({ contributor: "ERROR" }));

web/src/redux/actions/contributors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const fetchContributorsListAction =
88
(): ThunkAction<void, AppState, unknown, Action> => async (dispatch) => {
99
try {
1010
dispatch(contributorsPageSlice.actions.set({ contributorsList: null }));
11-
const { contributors } = await fetchV2("api:Contributors", {});
11+
const { contributors } = await fetchV2("api:contributors", {});
1212
dispatch(contributorsPageSlice.actions.set({ contributorsList: contributors }));
1313
} catch (error) {
1414
dispatch(contributorsPageSlice.actions.set({ contributorsList: "ERROR" }));

web/src/redux/actions/milestones.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const fetchMilestonesListAction =
99
try {
1010
if (getState().landingPage.milestones === "ERROR")
1111
dispatch(landingPageSlice.actions.set({ milestones: null }));
12-
const { milestones } = await fetchV2("api:MileStones/dzcode", {});
12+
const { milestones } = await fetchV2("api:milestones/dzcode", {});
1313
dispatch(landingPageSlice.actions.set({ milestones }));
1414
} catch (error) {
1515
dispatch(landingPageSlice.actions.set({ milestones: "ERROR" }));

web/src/redux/actions/project.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const fetchProjectAction =
1313
}
1414
try {
1515
dispatch(projectPageSlice.actions.set({ project: null }));
16-
const { project } = await fetchV2("api:Projects/:id", { params: { id } });
16+
const { project } = await fetchV2("api:projects/:id", { params: { id } });
1717
dispatch(projectPageSlice.actions.set({ project }));
1818
} catch (error) {
1919
dispatch(projectPageSlice.actions.set({ project: "ERROR" }));

web/src/redux/actions/projects.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const fetchProjectsListAction =
88
(): ThunkAction<void, AppState, unknown, Action> => async (dispatch) => {
99
try {
1010
dispatch(projectsPageSlice.actions.set({ projectsList: null }));
11-
const { projects } = await fetchV2("api:Projects", {});
11+
const { projects } = await fetchV2("api:projects", {});
1212
dispatch(projectsPageSlice.actions.set({ projectsList: projects }));
1313
} catch (error) {
1414
dispatch(projectsPageSlice.actions.set({ projectsList: "ERROR" }));

web/src/utils/search.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const useSearch = (query: string, limit: number = 5) => {
1010

1111
const search = useCallback(async () => {
1212
setIsFetching(true);
13-
const searchResults = await fetchV2("api:Search", {
13+
const searchResults = await fetchV2("api:search", {
1414
query: [
1515
["query", queryRef.current],
1616
["limit", limit],

0 commit comments

Comments
 (0)