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.
36 lines
774 B
36 lines
774 B
/*
|
|
* @Author: ch
|
|
* @Date: 2022-05-03 23:04:45
|
|
* @LastEditors: ch
|
|
* @LastEditTime: 2022-05-09 09:49:53
|
|
* @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(response => {
|
|
const result = response.data;
|
|
if(response.status === 200){
|
|
if(result.code === 'SUCCESS'){
|
|
return result.data;
|
|
}
|
|
return Promise.reject(result);
|
|
}
|
|
return Promise.reject({message:'请求出错'});
|
|
|
|
});
|
|
axios = $axios;
|
|
}
|
|
export { axios } |