Browse Source

chore: axios whit gateway

master
wangxiang 2 years ago
parent
commit
e704f01538
No known key found for this signature in database
GPG Key ID: 1BA7946AB6B232E4
  1. 2
      src/api/panel/index.js
  2. 2
      src/main.js
  3. 11
      src/utils/request.js

2
src/api/panel/index.js

@ -86,7 +86,7 @@ export function listCondition (query) { @@ -86,7 +86,7 @@ export function listCondition (query) {
// 查询监听器列表
export function listListener (query) {
return request({
url: '/workflow/extension/listener/list',
url: 'workflow_proxy/workflow/extension/listener/list',
method: 'get',
params: query
})

2
src/main.js

@ -10,7 +10,6 @@ import { useMicroAppStoreWithOut } from './store/modules/microApp' @@ -10,7 +10,6 @@ import { useMicroAppStoreWithOut } from './store/modules/microApp'
import { createPinia } from 'pinia'
import { isEmpty } from 'lodash-es'
const store = createPinia()
let instance = null
function render(props = {}) {
const { container, mountApp } = props
@ -22,6 +21,7 @@ function render(props = {}) { @@ -22,6 +21,7 @@ function render(props = {}) {
// fixme: 开发阶段使用,生产环境可以注释掉
if (!window.__POWERED_BY_QIANKUN__) {
window.$glob.ticket = '5607c923-5cfe-4950-b375-b72a28a1d5b8'
bootstrap().then(() => render())
}

11
src/utils/request.js

@ -2,21 +2,20 @@ import axios from 'axios' @@ -2,21 +2,20 @@ import axios from 'axios'
import qs from 'qs'
import { checkUrl } from './index'
window.$glob = {
url: '',
params: {},
url: process.env.VUE_APP_BASE_API,
ticket: '',
query: {},
header: {}
}
// 认证方案:使用token进行请求
window.$glob.params.token &&
(window.$glob.header['Authorization'] = `Bearer ${window.$glob.params.token}`)
axios.defaults.timeout = 30000
axios.defaults.validateStatus = function (status) {
return status >= 200 && status <= 500
}
axios.interceptors.request.use(config => {
if (!checkUrl(config.url)) config.url = window.$glob.url + config.url
// 认证方案:使用Bearer
window.$glob.ticket &&
(config.headers['Authorization'] = `Bearer ${window.$glob.ticket}`)
let header = window.$glob.header || {}
config.headers = Object.assign(config.headers, header)
let data = window.$glob.query || {}

Loading…
Cancel
Save