diff --git a/src/notifications/components/NotificationDisplay/NotificationDisplay.js b/src/notifications/components/NotificationDisplay/NotificationDisplay.js index 31f21ec209f4bfdfddb448bbf520b54e4f31faa4..9ccb49e87ffff37c08b67c6f98c8f8ed8944ffda 100644 --- a/src/notifications/components/NotificationDisplay/NotificationDisplay.js +++ b/src/notifications/components/NotificationDisplay/NotificationDisplay.js @@ -27,14 +27,18 @@ const NotificationDisplay = ({ } async function downloadAuditReport() { - const auditAdminData = await getAuditById(notification.id); - if (Object.keys(auditAdminData)?.length === 0) { - showSnackbar('An error occurred while downloading audit information', 'error'); + const response = await getAuditById(notification.id); + if (response.error) { + const msg = + response.payload.status === 404 + ? 'Audit not yet available. Please try again soon.' + : 'An error occurred while downloading audit information.'; + showSnackbar(msg, 'error'); return; } const url = window.URL.createObjectURL( - new Blob([JSON.stringify(auditAdminData)], {type: 'application/json'}) + new Blob([JSON.stringify(response.payload)], {type: 'application/json'}) ); const link = document.createElement('a'); link.href = url;