Vercel/src/platforms/vercel.ts
2025-02-17 17:54:00 -06:00

17 lines
369 B
TypeScript

import {
IS_PREVIEW,
VERCEL_BYPASS_KEY,
VERCEL_BYPASS_SECRET,
} from '@/app/config';
export const fetchWithBypass: typeof fetch = (url, options) =>
IS_PREVIEW && VERCEL_BYPASS_SECRET
? fetch(url, {
...options,
headers: {
...options?.headers,
[VERCEL_BYPASS_KEY]: VERCEL_BYPASS_SECRET,
},
})
: fetch(url, options);