import store from "../store";
axios.interceptors.request.use(function (config) {
	if(!config.url.includes('https://webim.tim.qq.com')){
		store.state.loading = true;
	}
	// this.$store.dispatch('loading',true)
	//let bb = this.$store.state.loading
    if(config.url.includes('http')){
		return config;
	}
	// else if(config.url.includes('detailByProjectId')){
	// 	config.url = window.WEB_CONF.api_url + config.url;
	// }
	else{
		if(location.href.indexOf('https')==0){
			console.log("======https:",window.WEB_CONF.api_url + config.url)
			config.url = window.WEB_CONF.api_url + config.url;
		}
		else{
			console.log("======----",window.WEB_CONF.api_url + config.url)
			config.url = window.WEB_CONF.api_url + config.url;
		}
	}

    return config;
    //console.log(config)
}, function (error) {
    //console.log(error)
});

axios.interceptors.response.use(function (response) {
    store.state.loading = false;
	let result = response;
    return result;
}, function (error) {
    //console.log(error)
});
