Skip to content

Commit

Permalink
feat: getApi header 컨텐트타입 추가 (#439)
Browse files Browse the repository at this point in the history
  • Loading branch information
jiwonh423 authored Sep 19, 2023
1 parent 9663453 commit c5df478
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion frontend/src/apis/getApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ async function withTokenRefresh<T>(callback: () => Promise<T>): Promise<T> {
console.log('AccessToken 만료되어 재요청합니다');

const headers: any = { Authorization: `Bearer ${userToken}` };
console.log(`Authorization : Bearer ${userToken}`);
//새로운 토큰 재발급
userToken = await refreshToken(headers);
localStorage.setItem('userToken', userToken);
Expand Down Expand Up @@ -65,7 +66,9 @@ export const getApi = async <T>(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}`;
Expand Down

0 comments on commit c5df478

Please sign in to comment.