Vue Interceptor 설정하여 Authorization 값 넣기
설정하기 headers.Authorization에 jwt 요청 마다 인증을 값을 넣어 백서버와 서로 인증을 할 수 있게 할것이다. 먼저 인증절차가 끝난 경로와 인증절차를 해야하는 경로 두개로 나누어 url.js파일을 만든다. 인증절차가 끝난 경로는 계속해서 인증값을 전달해주어야 하는데 이때 Interceptor 를 사용한다. 파일 구성은 이렇게 한다. 구성 interceptor.js //store에 저장된 토큰을 import하기 위함 import store from '../../store/storeIndex' export function setInterceptors (instance) { instance.interceptors.request.use( function (config) { //Authoriz..
2020.10.28