strapi-nextgen-framework
Version:
Production-ready, type-safe framework bridging Strapi v4 CMS and Next.js 14+ App Router with automatic cache management, Error Boundaries, and SEO optimization
26 lines • 898 B
JavaScript
;
/**
* Fetch wrapper with automatic cache tagging
* Wraps Next.js fetch to inject cache tags automatically
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.createCacheTaggedFetch = void 0;
/**
* Creates a fetch function that automatically adds cache tags
* This is used by graphql-request to make requests with Next.js caching
*
* @param logging - Optional logging configuration
* @returns Wrapped fetch function
*/
function createCacheTaggedFetch(logging) {
return async (input, init) => {
// Log cache tags if enabled
if (logging?.cacheTags && init?.next) {
console.log('[Strapi SDK] Cache tags:', init.next);
}
// Call Next.js fetch with cache configuration
return fetch(input, init);
};
}
exports.createCacheTaggedFetch = createCacheTaggedFetch;
//# sourceMappingURL=fetch-wrapper.js.map