From 9566f6e579c5ec2e015def32802a3c5931a276d6 Mon Sep 17 00:00:00 2001 From: Daniel Valdivia Date: Tue, 7 Apr 2020 13:29:40 -0700 Subject: [PATCH] Fix Groups Empty (#45) --- portal-ui/src/screens/Console/Groups/Groups.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/portal-ui/src/screens/Console/Groups/Groups.tsx b/portal-ui/src/screens/Console/Groups/Groups.tsx index d2f0ea26e0..e601fe388f 100644 --- a/portal-ui/src/screens/Console/Groups/Groups.tsx +++ b/portal-ui/src/screens/Console/Groups/Groups.tsx @@ -137,8 +137,16 @@ const Groups = ({ classes }: IGroupsProps) => { api .invoke("GET", `/api/v1/groups?offset=${offset}&limit=${rowsPerPage}`) .then((res: GroupsList) => { - setRecords(res.groups.sort(groupsSort)); - setTotalRecords(res.total); + let resGroups: string[] = []; + if (res.groups !== null) { + resGroups = res.groups.sort(groupsSort); + } + setRecords(resGroups); + let total = 0; + if (res.total !== null) { + total = res.total; + } + setTotalRecords(total); setError(""); isLoading(false);