From 32a5168a43fa7910594f7ae16e668dbf799e58d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Rialland?= Date: Tue, 20 Jun 2023 11:08:36 +0200 Subject: [PATCH] Fix error if plausible api is locked --- site/scripts/stats/fetch-api-stats.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/site/scripts/stats/fetch-api-stats.js b/site/scripts/stats/fetch-api-stats.js index 39bce7423..e21cac235 100644 --- a/site/scripts/stats/fetch-api-stats.js +++ b/site/scripts/stats/fetch-api-stats.js @@ -43,7 +43,10 @@ export const apiStats = async (start, end, interval) => { ) .filter((x) => !!x) .flatMap(({ results }, i) => - results.map(({ date, pageviews }) => ({ date, [names[i]]: pageviews })) + (results || []).map(({ date, pageviews }) => ({ + date, + [names[i]]: pageviews, + })) ) .reduce( (acc, el) => (