Skip to content

Commit

Permalink
Merge pull request #308 from AkshataKatwal16/relese-changes
Browse files Browse the repository at this point in the history
Issue bug:Add no data found according to changed userlist api response
  • Loading branch information
itsvick authored Nov 11, 2024
2 parents f9bc8bc + 4decaae commit cefd594
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/components/UserTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -897,8 +897,11 @@ console.log(code[0])
resp = await userList({ limit, filters, sort, offset, fields });

}
console.log(resp?.getUserDetails);
const result = enableCenterFilter?resp?.userDetails:resp?.getUserDetails;
if (!resp?.getUserDetails) {
setData([]);
//showToastMessage("No data found", "info");
}
const result = enableCenterFilter?resp?.userDetails:resp?.getUserDetails;
console.log(result)
console.log(resp?.totalCount)
if (resp?.totalCount >= 15) {
Expand Down Expand Up @@ -1029,7 +1032,7 @@ console.log(code[0])
}
console.log(finalResult)

if (filters?.name) {
if (filters?.name && resp?.getUserDetails) {
const prioritizedResult = finalResult.sort((a: any, b: any) => {
const aStartsWith = a.name.toLowerCase().startsWith(filters?.name);
const bStartsWith = b.name.toLowerCase().startsWith(filters?.name);
Expand All @@ -1040,9 +1043,14 @@ console.log(code[0])
});

setData(prioritizedResult);
} else {
} else if (resp?.getUserDetails){
setData(finalResult);
}
else
{
setData([]);

}

setLoading(false);
setCohortsFetched(false);
Expand Down Expand Up @@ -1508,6 +1516,9 @@ console.log(selectedBlockStore)
</Typography>
</Box>
);


console.log("data-----------------------------", data)
const userProps = {
userType: userType,
searchPlaceHolder: searchPlaceholder,
Expand Down

0 comments on commit cefd594

Please sign in to comment.