Skip to content

Commit

Permalink
record table update
Browse files Browse the repository at this point in the history
  • Loading branch information
okeken committed Sep 27, 2023
1 parent 0bba952 commit 93dee9f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 8 additions & 4 deletions views/users/hooks/useGetRecords.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@ const useGetRecords = (q: string) => {
setData((prev) => ({ ...prev, data: [], loading: true, error: false }));
try {
const data = await getRecords(q);
const mapped = data.map((items: any, index: number) => ({
...items,
SN: index + 1,
}));
const mapped = data.map((items: any, index: number) => {

return {
...items,
SN: index + 1,
role: !items?.role ? "others" : items.role
}
});
setData((prev) => ({
...prev,
loading: false,
Expand Down
2 changes: 2 additions & 0 deletions views/users/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const styles = { height: 400, width: 800 };
const defaultFields = [
{ field: "SN", filter: false, sortable: false },
{ field: "userName" },
{ field: "role" },
{ field: "email" },
{ field: "type" },
{ field: "companyName" },
Expand Down Expand Up @@ -52,6 +53,7 @@ const speakersField = [
const attendantsFields = [
{ field: "SN", filter: false, sortable: false },
{ field: "userName" },
{ field: "role" },
{ field: "email" },
{ field: "companyName" },
{ field: "location" },
Expand Down

0 comments on commit 93dee9f

Please sign in to comment.