标签:false store default error code += ios something http
import axios from 'axios'
import store from '../store/index'
axios.defaults.headers.post['Content-Type'] =
'application/x-www-form-urlencoded'
axios.defaults.baseURL =
process.env.NODE_ENV === 'production' ? 'https://gitee.com' : '/apk'
axios.interceptors.request.use(config => {
if (!config.url.includes('oauth')) {
config.baseURL += '/api/v5/'
}
return config
})
/* token过时判断 */
axios.interceptors.response.use(
function(response) {
if (store.state.loading == true) {
store.commit('setLoading', false)
}
return response
},
function(error) {
// Do something with request error
return Promise.reject(error)
}
)
export default axios
标签:false store default error code += ios something http
原文地址:https://www.cnblogs.com/ak-b/p/10525489.html