diff --git a/ui/package.json b/ui/package.json index 2a2c5da8..cc921cc0 100644 --- a/ui/package.json +++ b/ui/package.json @@ -15,7 +15,6 @@ "@antv/data-set": "^0.10.1", "@websanova/vue-auth": "^2.21.14-beta", "ant-design-vue": "~1.3.8", - "axios": "^0.18.0", "core-js": "^2.6.5", "enquire.js": "^2.1.6", "js-cookie": "^2.2.0", diff --git a/ui/src/components/tools/UserMenu.vue b/ui/src/components/tools/UserMenu.vue index aa98c29a..d53afd41 100644 --- a/ui/src/components/tools/UserMenu.vue +++ b/ui/src/components/tools/UserMenu.vue @@ -64,7 +64,7 @@ export default { onOk () { return that.$auth.logout({ makeRequest: true, - params: {}, // data: {} in axios + params: {}, // data: {} success: function () { that.LogoutSuccess({}) }, @@ -72,17 +72,6 @@ export default { redirect: '/login' // etc... }) - - // return that.Logout({}).then(() => { - // }) - - // window.location.reload() - // }).catch(err => { - // that.$message.error({ - // title: 'Logout error', - // description: err.message - // }) - // }) }, onCancel () { } diff --git a/ui/src/main.js b/ui/src/main.js index 46db9a55..3bf822bf 100644 --- a/ui/src/main.js +++ b/ui/src/main.js @@ -5,7 +5,6 @@ import Vue from 'vue' import App from './App.vue' import router from './router' import store from './store/' -// import { VueAxios } from './utils/request' import VueResource from 'vue-resource' import bootstrap from './core/bootstrap' diff --git a/ui/src/utils/axios.js b/ui/src/utils/axios.js deleted file mode 100644 index 3b91f6b5..00000000 --- a/ui/src/utils/axios.js +++ /dev/null @@ -1,35 +0,0 @@ -const VueAxios = { - vm: {}, - // eslint-disable-next-line no-unused-vars - install (Vue, instance) { - if (this.installed) { - return - } - this.installed = true - - if (!instance) { - // eslint-disable-next-line no-console - console.error('You have to install axios') - return - } - - Vue.axios = instance - - Object.defineProperties(Vue.prototype, { - axios: { - get: function get () { - return instance - } - }, - $http: { - get: function get () { - return instance - } - } - }) - } -} - -export { - VueAxios -} diff --git a/ui/src/utils/request.js b/ui/src/utils/request.js deleted file mode 100644 index 31168db2..00000000 --- a/ui/src/utils/request.js +++ /dev/null @@ -1,69 +0,0 @@ -// import Vue from 'vue' -// import axios from 'axios' -// import store from '@/store' -// import { -// VueAxios -// } from './axios' -// import notification from 'ant-design-vue/es/notification' -// import { -// ACCESS_TOKEN -// } from '@/store/mutation-types' - -// // 创建 axios 实例 -// const service = axios.create({ -// baseURL: '/api', // api base_url -// timeout: 6000 // 请求超时时间 -// }) - -// const err = (error) => { -// if (error.response) { -// const data = error.response.data -// const token = Vue.ls.get(ACCESS_TOKEN) -// if (error.response.status === 403) { -// notification.error({ -// message: 'Forbidden', -// description: data.message -// }) -// } -// if (error.response.status === 401 && !(data.result && data.result.isLogin)) { -// notification.error({ -// message: 'Unauthorized', -// description: 'Authorization verification failed' -// }) -// if (token) { -// store.dispatch('Logout').then(() => { -// setTimeout(() => { -// window.location.reload() -// }, 1500) -// }) -// } -// } -// } -// return Promise.reject(error) -// } - -// // request interceptor -// service.interceptors.request.use(config => { -// const token = Vue.ls.get(ACCESS_TOKEN) -// if (token) { -// config.headers['Access-Token'] = token // 让每个请求携带自定义 token 请根据实际情况自行修改 -// } -// return config -// }, err) - -// // response interceptor -// service.interceptors.response.use((response) => { -// return response.data -// }, err) - -// const installer = { -// vm: {}, -// install (Vue) { -// Vue.use(VueAxios, service) -// } -// } - -// export { -// installer as VueAxios, -// service as axios -// } diff --git a/ui/yarn.lock b/ui/yarn.lock index 35ee5bdc..114e4b2d 100644 --- a/ui/yarn.lock +++ b/ui/yarn.lock @@ -1937,14 +1937,6 @@ aws4@^1.8.0: resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f" integrity sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ== -axios@^0.18.0: - version "0.18.0" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.18.0.tgz#32d53e4851efdc0a11993b6cd000789d70c05102" - integrity sha1-MtU+SFHv3AoRmTts0AB4nXDAUQI= - dependencies: - follow-redirects "^1.3.0" - is-buffer "^1.1.5" - babel-code-frame@^6.22.0, babel-code-frame@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" @@ -4857,7 +4849,7 @@ fmin@0.0.2: tape "^4.5.1" uglify-js "^2.6.2" -follow-redirects@^1.0.0, follow-redirects@^1.3.0: +follow-redirects@^1.0.0: version "1.7.0" resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.7.0.tgz#489ebc198dc0e7f64167bd23b03c4c19b5784c76" integrity sha512-m/pZQy4Gj287eNy94nivy5wchN3Kp+Q5WgUPNy5lJSZ3sgkVKSYV/ZChMAQVIgx1SqfZ2zBZtPA2YlXIWxxJOQ==