This commit is contained in:
1 parent
5b29791fe0
commit
7c8115b298
2 files changed
+9
-3
No files matched your search
+2
-1
@@ -94,5 +94,6 @@ const fetchLatest = async (cache = []) => {
|
||||
}
|
||||
|
||||
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("endAt", Date.now());
|
||||
url.searchParams.append("type", "url");
|
||||
try {
|
||||
|
||||
const metrics = await EleventyFetch(url.toString(), {
|
||||
duration: '1h',
|
||||
@@ -18,10 +19,14 @@ export default async function(arg) {
|
||||
headers: {
|
||||
"Authorization": `Bearer ${apiKey}`,
|
||||
"Accept": "application/json"
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
return metrics.filter(metric => postRegex.test(metric.x))
|
||||
.map(({ x, y }) => ({ post: x, count: y }));
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user