Fixed incident data access
This commit is contained in:
1 parent
8ea0ef77e9
commit
193e7d7371
1 file changed
+5
-2
@@ -29,11 +29,14 @@ const Incidents = () => {
|
|||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
|
console.log(res);
|
||||||
// Reduce to a lookup object for 0(1) lookup
|
// Reduce to a lookup object for 0(1) lookup
|
||||||
if (res.data && res.data.data.length > 0) {
|
if (res?.data?.data?.monitors?.length > 0) {
|
||||||
const monitorLookup = res.data.data.reduce((acc, monitor) => {
|
const monitorLookup = res.data.data.monitors.reduce((acc, monitor) => {
|
||||||
acc[monitor._id] = monitor;
|
acc[monitor._id] = monitor;
|
||||||
return acc;
|
return acc;
|
||||||
}, {});
|
}, {});
|
||||||
|
|||||||
Reference in new issue
Block a user