xlb-main-login
Version:
``` yarn install ```
41 lines (38 loc) • 877 B
JavaScript
import axios from 'axios'
import { Modal } from 'ant-design-vue'
axios.interceptors.response.use(
(res) => {
if (res.success) {
return res
} else {
const warning = Modal.warning
warning({
title: '提示',
content: res.data.msg,
width: 390,
okText: '去授权',
cancelText: true,
centered: true,
maskClosable: true,
closable: true,
})
return res
}
},
(error) => {
console.log(error.response.data.error)
const warning = Modal.warning
warning({
title: '提示',
content: '请先授权公众号',
width: 390,
okText: '去授权',
cancelText: true,
centered: true,
maskClosable: true,
closable: true,
})
return Promise.reject(error)
}
)
export default axios