Commit bcdf5134 authored by 罗超's avatar 罗超

1

parent b539850b
...@@ -74,8 +74,7 @@ const service = Axios.create({ ...@@ -74,8 +74,7 @@ const service = Axios.create({
*/ */
service.interceptors.request.use( service.interceptors.request.use(
async (config: AxiosRequestConfig) => { async (config: AxiosRequestConfig) => {
console.log(config) // 如果是获取token接口:
// 如果是获取token接口:
if (config.url === '/auth/oauth/token') { if (config.url === '/auth/oauth/token') {
//TODO:用户登录的特殊处理, //TODO:用户登录的特殊处理,
} else { } else {
...@@ -110,7 +109,7 @@ service.interceptors.response.use( ...@@ -110,7 +109,7 @@ service.interceptors.response.use(
/** 请求有响应 */ /** 请求有响应 */
async (response: AxiosResponse) => { async (response: AxiosResponse) => {
if (response.status === 200) { if (response.status === 200) {
return Promise.resolve(response) return Promise.resolve(response.data)
} else { } else {
const __text = getErrorCode2text(response) const __text = getErrorCode2text(response)
return Promise.reject(new Error(__text)) return Promise.reject(new Error(__text))
......
import { boot } from 'quasar/wrappers' import { boot } from 'quasar/wrappers'
import axios, { AxiosInstance } from 'axios' import axios, { AxiosInstance } from 'axios'
import 'element-plus/dist/index.css'
declare module '@vue/runtime-core' { declare module '@vue/runtime-core' {
interface ComponentCustomProperties { interface ComponentCustomProperties {
$axios: AxiosInstance $axios: AxiosInstance
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment