Skip to content

Commit

Permalink
fix: access token 있는 경우에만 Authorization header
Browse files Browse the repository at this point in the history
  • Loading branch information
uiop5809 committed Aug 14, 2024
1 parent 16b4ba0 commit 7a9b65e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/apis/AxiosInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@ class Service {
baseURL: API_BASE_URL,
headers: {
'Content-Type': 'application/json',
Authorization:
typeof window !== 'undefined'
? `${localStorage.getItem('access_token')}`
: '',
},
})

if (typeof window !== 'undefined') {
this.http.defaults.headers.common.Authorization = `${localStorage.getItem('access_token')}`
const token = localStorage.getItem('access_token')
if (token) {
this.http.defaults.headers.common.Authorization = `${token}`
}
}
}
}
Expand Down

0 comments on commit 7a9b65e

Please sign in to comment.