From b9a59467baf3fb02fdc8f9df8337cb22e48ac76d Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Thu, 7 Sep 2023 18:21:31 -0500 Subject: [PATCH] Temporarily remove server-side auth() calls --- src/cache/index.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) 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', };