Fix Groups Empty (#45)

This commit is contained in:
Daniel Valdivia
2020-04-07 13:29:40 -07:00
committed by GitHub
parent 12a682e9f6
commit 9566f6e579

View File

@@ -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);