添加请求超时时间

fix/im-0526
ch 3 years ago
parent e4f8336673
commit 9df955e8d6

@ -99,8 +99,8 @@ export default {
methods: {
getList(id) {
let list = this.list.filter((item) => item.id == id);
console.log(`list[0]?.list`, list[0]?.list);
return list[0]?.list;
// console.log(`list[0]?.list`, list[0]?.list);
return list[0]?.list || [];
},
//
async getCategroyData() {

@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-05-03 23:04:45
* @LastEditors: ch
* @LastEditTime: 2022-05-09 09:49:53
* @LastEditTime: 2022-05-25 17:48:31
* @Description: file content
*/
let axios = null
@ -31,6 +31,7 @@ export default function({app, $axios, req}) {
return Promise.reject({message:'请求出错'});
});
$axios.defaults.timeout = 3000;
axios = $axios;
}
export { axios }

@ -2,12 +2,14 @@
* @Author: ch
* @Date: 2022-05-04 17:11:07
* @LastEditors: ch
* @LastEditTime: 2022-05-10 14:30:24
* @LastEditTime: 2022-05-25 17:48:35
* @Description: file content
*/
let axiosTk = null;
export default function ({$axios, store, route}, inject) {
const $axiosTk = $axios.create();
$axiosTk.defaults.timeout = 3000;
$axiosTk.onRequest( config =>{
if(!store.state.token){
location.href = '/';

Loading…
Cancel
Save