Skip to content

Commit

Permalink
[Issue #3884] Update saved opportunity endpoint from GET to POST (#3948)
Browse files Browse the repository at this point in the history
## Summary
Fixes #3884

### Time to review: __10 mins__

## Changes proposed
Updates to POST endpoint
  • Loading branch information
acouch authored Feb 20, 2025
1 parent cf4d77e commit b1af268
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
4 changes: 1 addition & 3 deletions frontend/src/services/fetch/endpointConfigs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ export const userLogoutEndpoint = {
method: "POST" as ApiMethod,
};

export const userSavedOpportunityEndpoint = (
type: "GET" | "POST" | "DELETE",
) => {
export const userSavedOpportunityEndpoint = (type: "POST" | "DELETE") => {
return {
basePath: environment.API_URL,
version: "v1",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/services/fetch/fetchers/fetchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,5 @@ export const fetchOpportunitySearch = requesterForEndpoint(

export const postUserLogout = requesterForEndpoint(userLogoutEndpoint);

export const userSavedOpportunity = (type: "GET" | "POST" | "DELETE") =>
export const userSavedOpportunity = (type: "POST" | "DELETE") =>
requesterForEndpoint(userSavedOpportunityEndpoint(type));
17 changes: 15 additions & 2 deletions frontend/src/services/fetch/fetchers/savedOpportunityFetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,23 @@ export const getSavedOpportunity = async (
const ssgToken = {
"X-SGG-Token": token,
};
const subPath = `${userId}/saved-opportunities`;
const resp = await userSavedOpportunity("GET")({
const body = {
pagination: {
page_offset: 1,
page_size: 5000,
sort_order: [
{
order_by: "created_at",
sort_direction: "descending",
},
],
},
};
const subPath = `${userId}/saved-opportunities/list`;
const resp = await userSavedOpportunity("POST")({
subPath,
additionalHeaders: ssgToken,
body,
});
const json = (await resp.json()) as { data: [] };
const savedOpportunities = json.data;
Expand Down

0 comments on commit b1af268

Please sign in to comment.