You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
shop-pc/plugins/axios.js

31 lines
659 B

/*
* @Author: ch
* @Date: 2022-05-03 23:04:45
* @LastEditors: ch
* @LastEditTime: 2022-05-04 18:32:54
* @Description: file content
*/
let axios = null
export default function({app, $axios, req}) {
// if(req){
// let str = 'Safari'
// if(req.headers['user-agent'].includes('Chrome')){
// str = 'Chrome'
// }
// console.log(str, req.headers['cookie'].split('token')[1]);
// }
// export default function ({app, $axios}) {
$axios.onRequest(()=>{
})
$axios.onResponse(res => {
if (res.data.code === 200) {
return res.data.result;
} else {
return Promise.reject(res.data.error);
}
});
axios = $axios;
}
export { axios }