Revert "fetch refactoring"

This reverts commit 0122e9b456.
This commit is contained in:
Cory Dransfeldt 2023-03-15 04:49:30 -07:00
parent e7421c5803
commit e4ad42cd7f
No known key found for this signature in database
4 changed files with 27 additions and 27 deletions

View file

@ -1,12 +1,12 @@
const fetch = require('node-fetch')
const { AssetCache } = require('@11ty/eleventy-fetch')
const EleventyFetch = require('@11ty/eleventy-fetch')
module.exports = async function () {
const url = 'https://utils.coryd.dev/api/webmentions'
const asset = new AssetCache('webmentions_data')
if (asset.isCacheValid('1h')) return await asset.getCachedValue()
const webmentions = await fetch(url).then((res) => res.json())
await asset.save(webmentions, 'json')
const res = EleventyFetch(url, {
duration: '1d',
type: 'json',
})
const webmentions = await res
return {
mentions: webmentions.children,
}