diff --git a/src/cache/index.ts b/src/cache/index.ts index 8d3b8e46..fbc39e31 100644 --- a/src/cache/index.ts +++ b/src/cache/index.ts @@ -1,4 +1,3 @@ -import { auth } from '@/auth'; import { getPhoto, getPhotos } from '@/services/postgres'; import { revalidatePath, revalidateTag, unstable_cache } from 'next/cache'; @@ -42,11 +41,9 @@ export const getPhotoCached: typeof getPhoto = (...args) => } )(); -export const getImageCacheHeadersForAuth = async () => { - const session = await auth(); - const shouldCacheRequest = !session?.user; +export const getImageCacheHeadersForAuth = async (shouldCache = true) => { return { - 'Cache-Control': shouldCacheRequest + 'Cache-Control': shouldCache ? 's-maxage=3600, stale-while-revalidate' : 's-maxage=1, stale-while-revalidate', };