axios的封装

181 阅读1分钟
import axios from 'axios'
import store from '@/store'
import xlsxjs from 'xlsx'
import router from './router'

// 封装
const inst = (flag) => {
  if (typeof store.state.isLogin.loginStore.auth_token === 'undefined') {
    router.push('/Login')
    return
  }
  return axios.create({
    baseURL:  window.BASE_URL ,
    timeout: 60000,
    headers: {
      Authorization: flag == false ? undefined  : ( 'Token ' + store.state.isLogin.loginStore.auth_token)
    }
  })
}

export const fc_simpleanalysis = (param, config) => inst().post(`/apiIter/fc_simpleanalysis/`, param, config)

export const ExportReport = (param) => inst().post(`/3v3/ExportReport/`, param)

export const CheckUserPower = param => inst().get(`/v3/CheckUserPower/`, param)