const wpURL = `${process.env.NEXT_PUBLIC_WP_API}/wp-json/wp/v2/${type}?page=${page}`
let wpReq = new Request(wpURL, {
method: 'GET',
cf: {
cacheTtl: WP_CACHE_TIME,
cacheEverything: true,
},
})
const wpResp = await fetch(wpReq)
if (!wpResp.ok) {
console.error('failed to fetch wp content', wpResp.status)
return {}
}
const wpRes = await wpResp.json()
wpResp.headers.forEach((value, name) => {
console.log(`header ${name}: ${value}`)
})
const wpURL = `${process.env.NEXT_PUBLIC_WP_API}/wp-json/wp/v2/${type}?page=${page}`
let wpReq = new Request(wpURL, {
method: 'GET',
cf: {
cacheTtl: WP_CACHE_TIME,
cacheEverything: true,
},
})
const wpResp = await fetch(wpReq)
if (!wpResp.ok) {
console.error('failed to fetch wp content', wpResp.status)
return {}
}
const wpRes = await wpResp.json()
wpResp.headers.forEach((value, name) => {
console.log(`header ${name}: ${value}`)
})