Skip to content

Commit

Permalink
CL-584 -- fixed query endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
harsh12-99 committed Dec 12, 2023
1 parent c760aab commit 3eb9ff0
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions src/redux/actions/api/Organization/FetchPaginatedOrgTaskList.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,25 @@ export default class FetchPaginatedOrgTaskListAPI extends API {
this.filter = filter;
this.sortOptions = sortOptions;

this.getTargetEndpoint = `${
ENDPOINTS.organization
}${id}/list_org_tasks/?limit=${this.limit}&offset=${this.offset}&sort_by=${
this.sortOptions.sortBy
}&reverse=${this.sortOptions.order}&filter=${JSON.stringify(
this.filter
)}&search=${JSON.stringify(this.search)}`;

this.endpoint = `${super.apiEndPointAuto()}${this.getTargetEndpoint}`;
const params = new URLSearchParams();
params.append("limit", this.limit);
params.append("offset", this.offset);

if (this.sortOptions.sortBy !== "") {
params.append("sort_by", this.sortOptions.sortBy);
}

if (this.sortOptions.order !== "") {
params.append("reverse", this.sortOptions.order);
}

params.append("filter", JSON.stringify(this.filter));
params.append("search", JSON.stringify(this.search));

const baseUrl = `${ENDPOINTS.organization}${id}/list_org_tasks/`;
const finalUrl = `${baseUrl}?${params.toString()}`;

this.endpoint = `${super.apiEndPointAuto()}${finalUrl}`;
}

processResponse(res) {
Expand Down

0 comments on commit 3eb9ff0

Please sign in to comment.