Skip to content

Commit

Permalink
Merge pull request #627 from Vayras/frontendissue/625
Browse files Browse the repository at this point in the history
Fixed Filter For pending showing paid bounties
  • Loading branch information
humansinstitute authored Nov 11, 2024
2 parents 4508249 + ab9c12a commit bd15e57
Showing 1 changed file with 29 additions and 7 deletions.
36 changes: 29 additions & 7 deletions src/store/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ export class MainStore {

getWantedsSpecWorkspacePrevParams?: QueryParams = {};
async getSpecificWorkspaceBounties(uuid: string, params?: any): Promise<PersonBounty[]> {
const queryParams: QueryParams = {
let queryParams: QueryParams = {
limit: queryLimit,
sortBy: 'created',
search: uiStore.searchText ?? '',
Expand All @@ -985,12 +985,34 @@ export class MainStore {
this.getWantedsSpecWorkspacePrevParams = queryParams;
}

// if we don't pass the params, we should use previous params for invalidate query
const query2 = this.appendQueryParams(
`workspaces/bounties/${uuid}`,
queryLimit,
params ? queryParams : this.getWantedsWorkspacePrevParams
);
let newParams = {};
if (params.Pending === 'true' || params.Pending === true) {
if (params.Paid === 'false' || params.Paid === false) {
newParams = {
page: 1,
resetPage: true,
Open: false,
Assigned: false,
Paid: false,
Completed: true,
Pending: false,
Failed: false,
pending: true,
languageString: '',
direction: 'desc'
};
}
}

// Use newParams if the condition is met; otherwise, fallback to existing params
queryParams =
(params.Pending === 'true' || params.Pending === true) &&
(params.Paid === 'false' || params.Paid === false)
? newParams
: params;

const query2 = this.appendQueryParams(`workspaces/bounties/${uuid}`, queryLimit, queryParams);

try {
const ps2 = await api.get(query2);
const ps3: any[] = [];
Expand Down

0 comments on commit bd15e57

Please sign in to comment.