Handle umami errors
All checks were successful
Build and copy to prod / build-and-copy (push) Successful in 3m47s
All checks were successful
Build and copy to prod / build-and-copy (push) Successful in 3m47s
This commit is contained in:
parent
5b29791fe0
commit
7c8115b298
@ -94,5 +94,6 @@ const fetchLatest = async (cache = []) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default async function() {
|
export default async function() {
|
||||||
return await fetchLatest(cachedContent());
|
return [];
|
||||||
|
// return await fetchLatest(cachedContent());
|
||||||
}
|
}
|
@ -10,6 +10,7 @@ export default async function(arg) {
|
|||||||
url.searchParams.append("startAt", 0);
|
url.searchParams.append("startAt", 0);
|
||||||
url.searchParams.append("endAt", Date.now());
|
url.searchParams.append("endAt", Date.now());
|
||||||
url.searchParams.append("type", "url");
|
url.searchParams.append("type", "url");
|
||||||
|
try {
|
||||||
|
|
||||||
const metrics = await EleventyFetch(url.toString(), {
|
const metrics = await EleventyFetch(url.toString(), {
|
||||||
duration: '1h',
|
duration: '1h',
|
||||||
@ -18,10 +19,14 @@ export default async function(arg) {
|
|||||||
headers: {
|
headers: {
|
||||||
"Authorization": `Bearer ${apiKey}`,
|
"Authorization": `Bearer ${apiKey}`,
|
||||||
"Accept": "application/json"
|
"Accept": "application/json"
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
return metrics.filter(metric => postRegex.test(metric.x))
|
return metrics.filter(metric => postRegex.test(metric.x))
|
||||||
.map(({ x, y }) => ({ post: x, count: y }));
|
.map(({ x, y }) => ({ post: x, count: y }));
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
return [];
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user