feat: mock when running locally

This commit is contained in:
Cory Dransfeldt 2024-02-08 16:42:17 -08:00
parent 12f4929dd3
commit 6757a60134
No known key found for this signature in database
22 changed files with 1342 additions and 300 deletions

View file

@ -1,11 +1,16 @@
import EleventyFetch from '@11ty/eleventy-fetch'
import StatusMock from './json/mocks/status.js'
export default async function () {
const url = 'https://api.omg.lol/address/cory/statuses/'
const res = EleventyFetch(url, {
duration: '1h',
type: 'json',
}).catch()
const status = await res
return status.response['statuses'][0]
if (process.env.ELEVENTY_PRODUCTION) {
const res = EleventyFetch(url, {
duration: '1h',
type: 'json',
}).catch()
const status = await res
return status.response['statuses'][0]
} else {
return StatusMock
}
}