UNPKG

gatsby-source-prismic

Version:

Gatsby source plugin for building websites using Prismic as a data source

21 lines (20 loc) 558 B
const cachedFetch = async (input, init, args) => { const cacheKey = `fetchLike(${args.name})___${JSON.stringify({ input, init })}`; const cachedValue = await args.cache.get(cacheKey); const { Response } = await import("node-fetch"); if (cachedValue !== void 0) { return new Response(cachedValue); } else { const result = await args.fetch(input, init); const text = await result.text(); args.cache.set(cacheKey, text); return new Response(text); } }; export { cachedFetch }; //# sourceMappingURL=cachedFetch.js.map