vue2_frontend...
This commit is contained in:
parent
fd6b75ce16
commit
3501f805fa
@ -2,9 +2,6 @@ import authApi from './auth.api'
|
|||||||
import tokenService from '../service/token.service'
|
import tokenService from '../service/token.service'
|
||||||
const interceptor = (instance) => {
|
const interceptor = (instance) => {
|
||||||
//API Request 전 처리용
|
//API Request 전 처리용
|
||||||
instance.defaults.headers.post['Content-Type'] =
|
|
||||||
'application/x-www-form-urlencoded'
|
|
||||||
instance.defaults.headers.get['Accepts'] = 'application/json'
|
|
||||||
instance.defaults.timeout = 2500
|
instance.defaults.timeout = 2500
|
||||||
|
|
||||||
//Request 처리용
|
//Request 처리용
|
||||||
@ -13,6 +10,8 @@ const interceptor = (instance) => {
|
|||||||
const token = tokenService.getAccessToken()
|
const token = tokenService.getAccessToken()
|
||||||
if (token) {
|
if (token) {
|
||||||
config['headers'] = {
|
config['headers'] = {
|
||||||
|
post: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||||
|
get: { Accepts: 'application/json' },
|
||||||
Authorization: `Bearer ${token}`, // for Spring Boot back-end
|
Authorization: `Bearer ${token}`, // for Spring Boot back-end
|
||||||
'x-access-token': token // for Node.js Express back-end
|
'x-access-token': token // for Node.js Express back-end
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user