website refactor
This commit is contained in:
@@ -230,12 +230,26 @@ export class BaseApiClient {
|
||||
|
||||
const executeRequest = async (signal: AbortSignal): Promise<T> => {
|
||||
const isFormData = typeof FormData !== 'undefined' && data instanceof FormData;
|
||||
const headers: HeadersInit = isFormData
|
||||
const headers: Record<string, string> = isFormData
|
||||
? {}
|
||||
: {
|
||||
'Content-Type': 'application/json',
|
||||
};
|
||||
|
||||
// Forward cookies if running on server
|
||||
if (typeof window === 'undefined') {
|
||||
try {
|
||||
const { cookies } = await import('next/headers');
|
||||
const cookieStore = await cookies();
|
||||
const cookieString = cookieStore.toString();
|
||||
if (cookieString) {
|
||||
headers['Cookie'] = cookieString;
|
||||
}
|
||||
} catch (e) {
|
||||
// Not in a request context or next/headers not available
|
||||
}
|
||||
}
|
||||
|
||||
const config: RequestInit = {
|
||||
method,
|
||||
headers,
|
||||
|
||||
Reference in New Issue
Block a user