Don't error out if we can't fetch reports

This commit is contained in:
FloatingGhost 2022-11-21 17:08:53 +00:00
parent e4e8ed812b
commit b1f41add0e

View file

@ -650,7 +650,7 @@ const getReports = ({ state, limit, page, pageSize, credentials }) => {
url = url + (args ? '?' + args : '') url = url + (args ? '?' + args : '')
return fetch(url, { headers: authHeaders(credentials) }) return fetch(url, { headers: authHeaders(credentials) })
.then((data) => data.json()) .then((data) => data.json())
.then((data) => data.reports.map(parseReport)) .then((data) => data?.reports?.map(parseReport) ?? [])
} }
const updateReportStates = ({ credentials, reports }) => { const updateReportStates = ({ credentials, reports }) => {