Temporarily remove server-side auth() calls

This commit is contained in:
Sam Becker 2023-09-07 18:21:31 -05:00
parent 9c94c0b56b
commit b9a59467ba

7
src/cache/index.ts vendored
View File

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