axios fix
Former-commit-id: 4e67b101d7613dc5a908a9710a298ab452e3a73e [formerly 4e67b101d7613dc5a908a9710a298ab452e3a73e [formerly 4e67b101d7613dc5a908a9710a298ab452e3a73e [formerly 4e67b101d7613dc5a908a9710a298ab452e3a73e [formerly e18674e079add9386877561fd5ff11e26d8a444d [formerly 9eea4ceea3d3b77eab71336bd5a35f3865865a7a]]]]] Former-commit-id: 309a390168260b7182beb6cefb1d3fce25f41ad7 Former-commit-id: 2357580897c1c29d440ef3df6f59ccf8ecf6c898 Former-commit-id: 4dec8fba40d4f2d2c38e214281019b42cb937d0f [formerly d5986fb5b1d943e920a5e9f298bcfe2f39db84a6] Former-commit-id: 2f5e3bf693e575217a377d633480e214609a257b Former-commit-id: 67a233f1a96a698c8a303437bd350eef012f426a Former-commit-id: 3529a8cb845e843a7971eaa2ae108e8c4abd7859 Former-commit-id: 75fdfbf8e6258c417b6f187dc4d5a4be1090aa56 Former-commit-id: b089d7b7d80123e876bf9b03d5bf9593fd79f780
This commit is contained in:
@@ -1 +1 @@
|
||||
208665c165b32daf4021f61c3ad430a972cb9735
|
||||
937f5369a5d9b43eeb3c7fa2991f76724481721c
|
||||
@@ -7,10 +7,3 @@ export function ComponentsMarkdownBase (url) {
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function ComponentsMarkdownApi (url) {
|
||||
return request({
|
||||
url,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
17
src/api/sys/http/index.js
Normal file
17
src/api/sys/http/index.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import request from '@/plugin/axios'
|
||||
|
||||
export function httpGet (url, params = {}) {
|
||||
return request({
|
||||
url,
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function httpPost (url, data = {}) {
|
||||
return request({
|
||||
url,
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
@@ -38,7 +38,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
ajax () {
|
||||
PluginMocksAjax
|
||||
PluginMocksAjax()
|
||||
.then(res => {
|
||||
this.table.columns = Object.keys(res.list[0]).map(e => ({
|
||||
label: e,
|
||||
|
||||
@@ -11,11 +11,13 @@ const service = axios.create({
|
||||
// request interceptor
|
||||
service.interceptors.request.use(
|
||||
config => {
|
||||
// Do something before request is sent
|
||||
const token = util.cookies.get('token')
|
||||
if (token && token !== 'undefined') {
|
||||
// 让每个请求携带token-- ['X-Token']为自定义key 请根据实际情况自行修改
|
||||
config.headers['X-Token'] = token
|
||||
if (!(/^https:\/\/|http:\/\//.test(config.url))) {
|
||||
// Do something before request is sent
|
||||
const token = util.cookies.get('token')
|
||||
if (token && token !== 'undefined') {
|
||||
// 让每个请求携带token-- ['X-Token']为自定义key 请根据实际情况自行修改
|
||||
config.headers['X-Token'] = token
|
||||
}
|
||||
}
|
||||
return config
|
||||
},
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import axios from 'axios'
|
||||
import { httpGet } from '@/api/sys/http'
|
||||
import semver from 'semver'
|
||||
import util from '@/libs/util.js'
|
||||
import setting from '@/setting.js'
|
||||
@@ -19,7 +19,7 @@ export default {
|
||||
* @param {Object} param context
|
||||
*/
|
||||
checkUpdate ({ state, commit }) {
|
||||
axios.get(setting.releases.api)
|
||||
httpGet(setting.releases.api)
|
||||
.then(res => {
|
||||
let versionGet = res.tag_name
|
||||
const update = semver.lt(state.version, versionGet)
|
||||
|
||||
Reference in New Issue
Block a user