Skip to content

Commit

Permalink
sort names alphabetically in results
Browse files Browse the repository at this point in the history
  • Loading branch information
devksingh4 committed Sep 11, 2024
1 parent 31313a9 commit 034db97
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion clientv2/src/pages/recruiter/RecruiterHome.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ export function RecruiterHomePage() {
setLoading(false);
return showErrorNotification();
}
setApiResponse(response.data);
const sortedData = response.data.sort(function(a: Record<string, string>, b: Record<string, string>) {
const keyA = a.name.toLowerCase(), keyB = b.name.toLowerCase();
if (keyA < keyB) return -1;
if (keyA > keyB) return 1;
return 0;
});
setApiResponse(sortedData);
setLoading(false);
return undefined;
};
Expand Down

0 comments on commit 034db97

Please sign in to comment.