Skip to content

Commit

Permalink
Merge pull request #231 from upendraTekdi/admin_uk
Browse files Browse the repository at this point in the history
Task #223475: add react query for fetch cohort list , change url structure, update list after change district from first page
  • Loading branch information
itsvick authored Sep 30, 2024
2 parents 8de712a + 5a281e5 commit d07b9d7
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/pages/centers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,8 @@ finalResult?.forEach((item: any, index: number) => {
});
}
}
setPageOffset(Numbers.ZERO);
fetchUserList();
};
const handleBlockChange = (selected: string[], code: string[]) => {
setSelectedBlock(selected);
Expand Down Expand Up @@ -795,7 +797,16 @@ finalResult?.forEach((item: any, index: number) => {
},
};

const result = await getCohortList(data);
// const result = await getCohortList(data);
const result = await queryClient.fetchQuery({
queryKey: [
QueryKeys.GET_COHORT_LIST,
data.limit,
data.offset,
data.filters,
],
queryFn: () => getCohortList(data),
});

if (!result || !result.results || !result.results.cohortDetails) {
console.log("Invalid response structure or no cohort details found.");
Expand Down Expand Up @@ -825,10 +836,11 @@ finalResult?.forEach((item: any, index: number) => {
"Incomplete location data (state, district, block) for the cohort."
);
}


if (urlData) {
router.push(
`learners/${urlData.stateCode}/${urlData.districtCode}/${urlData.blockCode}/${urlData.type}`
`learners?state=${urlData.stateCode}&district=${urlData.districtCode}&block=${urlData.blockCode}&status=${urlData.type}`
);
}

Expand Down

0 comments on commit d07b9d7

Please sign in to comment.