Filter empty response
parent
97490b615d
commit
083f7231a5
|
@ -27,7 +27,7 @@ const fetchApiStats = async (page, start, end, interval) => {
|
|||
}),
|
||||
})
|
||||
|
||||
return result.json()
|
||||
return await result.json()
|
||||
}
|
||||
|
||||
export const apiStats = async (start, end, interval) => {
|
||||
|
@ -40,6 +40,7 @@ export const apiStats = async (start, end, interval) => {
|
|||
fetchApiStats('/api/v1/rules/*', start, end, interval),
|
||||
])
|
||||
)
|
||||
.filter((x) => !!x)
|
||||
.flatMap(({ results }, i) =>
|
||||
results.map(({ date, pageviews }) => ({ date, [names[i]]: pageviews }))
|
||||
)
|
||||
|
|
|
@ -291,6 +291,7 @@ async function main() {
|
|||
},
|
||||
nbAnswersLast30days: 0,
|
||||
})
|
||||
|
||||
try {
|
||||
if (
|
||||
!process.env.ATINTERNET_API_ACCESS_KEY ||
|
||||
|
|
Loading…
Reference in New Issue