PCORE-2213: added check for data from api (#37)

* feat: minor cosmetic change in showing dates

* feat: minor cosmetic change in showing dates

* feat: scroll to input when editing incident

* fix: class to classname

* fix: added array check for api data

* feat: used created_at instead of updated_at
pull/1113/head
Smit Patel 2022-08-16 12:08:12 +05:30 committed by GitHub
parent 4dbafb51f2
commit 14e6b69c6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -17,7 +17,9 @@ const IncidentsBlock = ({ service, group }) => {
data = await API.incidents_service(service.id);
}
setIncidents(data || []);
if(Array.isArray(data)) {
setIncidents(data);
}
}
fetchData();
}, [service.id, group?.id]);
@ -37,7 +39,7 @@ const IncidentsBlock = ({ service, group }) => {
const latestUpdate =
updates?.length > 0 && updates[0];
const updatedAt = latestUpdate
? latestUpdate.updated_at
? latestUpdate.created_at
: updated_at;
return (