我有一个大文件,需要使用axios从服务器下载,但是1分钟后请求被终止,并且文件没有下载,因此我需要等待它得到响应的过程
这适用于vue.js中的Axios。尝试将超时值设置为10分钟以上,但这没有帮助
progress=0;
this.$store.commit("routeChange", "start");
this.progress = true;
var timestamp = Math.round(+new Date() / 1000);
var userip = '127.0.1';
var data = {
page: {
startIndex: 0,
size: 10000
},
days: 0,
fromDate: "",
toDate: "",
mandateID: ""
};
var msgHeader = {
authToken: localStorage.getItem('authtoken'), //dynamic
authLoginID: this.$store.getters.loginId,
timestamp: timestamp,
ipAddress: userip
};
this.$root.$emit('component1',false);
var mlShowMandateData = {data, msgHeader};
const instance = axios.create();
//increased Timeout value
instance.defaults.timeout = 6000000;
instance.post('mlShowMandateData', mlShowMandateData).then((response) => {
progress = 1;
const JSONData = response.data;
if (JSONData.data.error == 0) {
this.$store.commit('setauthtoken', {
authtoken: JSONData.msgHeader.authToken
});
localStorage.setItem('authtoken',JSONData.msgHeader.authToken);
});
}
this.rows = this.data.rows;
//this.rows = this.data.rows;
this.$root.$emit('component1' , true);
}
else {
});
}
this.$store.commit("routeChange", "end");
this.progress = false;
})
},
我希望进程等待响应,但是1分钟后它将停止执行