From 1c98f83b59b049e1dc0a7d920ced9494f4b2f821 Mon Sep 17 00:00:00 2001 From: althafdaa Date: Sun, 4 Aug 2024 22:07:06 +0700 Subject: [PATCH] chore: revert fetch wrapper --- src/utils/fetch-wrapper.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/utils/fetch-wrapper.ts b/src/utils/fetch-wrapper.ts index 97f3467..7d3dcbd 100644 --- a/src/utils/fetch-wrapper.ts +++ b/src/utils/fetch-wrapper.ts @@ -64,7 +64,9 @@ export const fetchInstance = async ( const headers: HeadersInit & { 'Content-Type'?: string; - } = {}; + } = { + 'Content-Type': 'application/json', + }; const accessToken = nookies.get(c).access_token; if (accessToken) { @@ -78,8 +80,8 @@ export const fetchInstance = async ( } const isFormData = body instanceof FormData; - if (!isFormData) { - headers['Content-Type'] = 'application/json'; + if (isFormData) { + delete headers['Content-Type']; } const config: RequestInit = {