diff --git a/src/components/Admin/Document/AdminDocumentTable/AdminDocumentTable.js b/src/components/Admin/Document/AdminDocumentTable/AdminDocumentTable.js index ae1a4056..0ee7224a 100644 --- a/src/components/Admin/Document/AdminDocumentTable/AdminDocumentTable.js +++ b/src/components/Admin/Document/AdminDocumentTable/AdminDocumentTable.js @@ -22,7 +22,10 @@ const AdminDocumentTable = ({ document, alerts, setAlerts }) => { if (document) { const fetchGroupState = async () => { document.groups.map(async (group) => { - const name = await getGroupNameById(group); + const name = await getGroupNameById(group) + .catch((err) => { + setAlerts([...alerts, { text: err.message, variant: 'danger' }]); + }); setGroupState((prevState) => ({ ...prevState, [group]: name, diff --git a/src/components/Dashboard/DashboardDocumentList/DashboardDocumentList.js b/src/components/Dashboard/DashboardDocumentList/DashboardDocumentList.js index 516501bd..55a8d2e2 100644 --- a/src/components/Dashboard/DashboardDocumentList/DashboardDocumentList.js +++ b/src/components/Dashboard/DashboardDocumentList/DashboardDocumentList.js @@ -45,7 +45,10 @@ const DashboardDocumentList = ({ const fetchGroupState = async () => { documents.map((document) => document.groups.map(async (group) => { if (!documentGroupState[group]) { - const name = await getGroupNameById(group); + const name = await getGroupNameById(group) + .catch((err) => { + setAlerts([...alerts, { text: err.message, variant: 'danger' }]); + }); setDocumentGroupState((prevState) => ({ ...prevState, [group]: name, diff --git a/src/components/DocumentList/DocumentList.js b/src/components/DocumentList/DocumentList.js index c7c55d0b..54e08a37 100644 --- a/src/components/DocumentList/DocumentList.js +++ b/src/components/DocumentList/DocumentList.js @@ -50,7 +50,10 @@ const DocumentList = ({ const fetchGroupState = async () => { documents.map((document) => document.groups.map(async (group) => { if (!groupState[group]) { - const name = await getGroupNameById(group); + const name = await getGroupNameById(group) + .catch((err) => { + setAlerts([...alerts, { text: err.message, variant: 'danger' }]); + }); setGroupState((prevState) => ({ ...prevState, [group]: name,