From c5df4781444a982bc0bddf0705f5e445707e5403 Mon Sep 17 00:00:00 2001 From: afds4567 <33995840+afds4567@users.noreply.github.com> Date: Tue, 19 Sep 2023 19:52:27 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20getApi=20header=20=EC=BB=A8=ED=85=90?= =?UTF-8?q?=ED=8A=B8=ED=83=80=EC=9E=85=20=EC=B6=94=EA=B0=80=20(#439)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/apis/getApi.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/apis/getApi.ts b/frontend/src/apis/getApi.ts index 83bc0f8b..c3921340 100644 --- a/frontend/src/apis/getApi.ts +++ b/frontend/src/apis/getApi.ts @@ -37,6 +37,7 @@ async function withTokenRefresh(callback: () => Promise): Promise { console.log('AccessToken 만료되어 재요청합니다'); const headers: any = { Authorization: `Bearer ${userToken}` }; + console.log(`Authorization : Bearer ${userToken}`); //새로운 토큰 재발급 userToken = await refreshToken(headers); localStorage.setItem('userToken', userToken); @@ -65,7 +66,9 @@ export const getApi = async (url: string) => { await withTokenRefresh(async () => { const apiUrl = `${DEFAULT_PROD_URL + url}`; const userToken = localStorage.getItem('userToken'); - const headers: any = {}; + const headers: any = { + 'content-type': 'application/json', + }; if (userToken) { headers['Authorization'] = `Bearer ${userToken}`;