123456789101112131415161718192021222324252627282930 |
- /*
- * @Description:
- * @Author: 欧阳承珺
- * @LastEditors: 欧阳承珺
- * @Date: 2022-10-19 13:58:11
- * @LastEditTime: 2022-10-26 15:50:35
- */
- import { Message } from 'element-ui';
- export default function({store, app:{ $axios, rediret}} ) {
- $axios.onRequest(config => {
- $axios.setToken(store.state.token, 'Bearer')
- })
- $axios.onError(error => {
- const code = parseInt(error.response && error.response.status)
- if (code !== 200) {
- Message.error(error.response.data.msg)
- // redirect('/400')
- }
- })
- $axios.onResponse((res) => {
- if (res.data.code !== 200) {
- Message.error(res.data.msg)
- }
- return res.data
- })
- }
|