Skip to content

Commit

Permalink
#56 Fix bug when user has no groups
Browse files Browse the repository at this point in the history
  • Loading branch information
blms committed Nov 18, 2020
1 parent 26c6fbc commit f41df62
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,15 @@ const DashboardAnnotationList = ({
async function fetchData() {
if (session && (session.user.groups || session.user.id)) {
if (key === 'shared') {
setAnnotations(
await getSharedAnnotations(session.user.groups, limit)
.then(setListLoading(false))
.catch((err) => setAlerts([...alerts, { text: err.message, variant: 'danger' }])),
);
if (session.user.groups && session.user.groups.length > 0) {
setAnnotations(
await getSharedAnnotations(session.user.groups, limit)
.then(setListLoading(false))
.catch((err) => setAlerts([...alerts, { text: err.message, variant: 'danger' }])),
);
} else {
setAnnotations([]);
}
} else if (key === 'mine') {
setAnnotations(
await getOwnAnnotations(session.user.id, limit)
Expand Down

0 comments on commit f41df62

Please sign in to comment.