import axios from 'axios'
import { Message } from 'element-ui'
import store from '@/store'
import { getToken } from '@/utils/auth'

const setJoken = axios.create({
  baseURL: process.env.BASE_API,
  timeout: 10000
})
setJoken.interceptors.request.use(
  config => {
    if (getToken()) {
      config.headers['J-Token'] = getToken()
    }
    return config
  },
  error => {
    Promise.reject(error)
  }
)
setJoken.interceptors.response.use(
  response => response,
  error => {
  }
)
export default setJoken
