Fixed incident data access

This commit is contained in:
Alex Holliday committed 2024-09-04 23:14:15 -07:00
1 parent 8ea0ef77e9
commit 193e7d7371
1 file changed
+5 -2
+5 -2
View File
@@ -29,11 +29,14 @@ const Incidents = () => {
null,
null,
null,
null,
null,
null
);
console.log(res);
// Reduce to a lookup object for 0(1) lookup
if (res.data && res.data.data.length > 0) {
const monitorLookup = res.data.data.reduce((acc, monitor) => {
if (res?.data?.data?.monitors?.length > 0) {
const monitorLookup = res.data.data.monitors.reduce((acc, monitor) => {
acc[monitor._id] = monitor;
return acc;
}, {});