Filter empty response

pull/2311/head
Jérémy Rialland 2022-10-10 13:59:47 +02:00 committed by Jérémy Rialland
parent 97490b615d
commit 083f7231a5
2 changed files with 3 additions and 1 deletions

View File

@ -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 }))
)

View File

@ -291,6 +291,7 @@ async function main() {
},
nbAnswersLast30days: 0,
})
try {
if (
!process.env.ATINTERNET_API_ACCESS_KEY ||