From db623812aa0b5198c903b3fadd7e2bf796acdeaa Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Thu, 22 Jul 2021 16:18:47 +0800 Subject: [PATCH] Debug axios --- src/libs/axios.js | 6 +++++- src/main.js | 1 + src/views/Governance.vue | 3 --- src/views/Info.vue | 14 +++++++++++++- vue.config.js | 18 +++++++++++------- 5 files changed, 30 insertions(+), 12 deletions(-) diff --git a/src/libs/axios.js b/src/libs/axios.js index 82745fe8..e58f08de 100644 --- a/src/libs/axios.js +++ b/src/libs/axios.js @@ -6,9 +6,13 @@ import axios from 'axios' const axiosIns = axios.create({ // You can add your headers here // ================================ - // baseURL: 'https://some-domain.com/api/', + baseURL: 'http://lcd.akash.forbole.com', // timeout: 1000, // headers: {'X-Custom-Header': 'foobar'} + headers: { + 'Access-Control-Allow-Origin': '*', + 'Content-Type': 'application/json', + }, }) Vue.prototype.$http = axiosIns diff --git a/src/main.js b/src/main.js index 516f82f8..35a5e602 100644 --- a/src/main.js +++ b/src/main.js @@ -11,6 +11,7 @@ import App from './App.vue' // Global Components import './global-components' +import '@/libs/axios' // 3rd party plugins import '@/libs/portal-vue' diff --git a/src/views/Governance.vue b/src/views/Governance.vue index fe4e90d7..f5c54b86 100644 --- a/src/views/Governance.vue +++ b/src/views/Governance.vue @@ -199,9 +199,6 @@ import { BRow, BCol, BCard, BCardTitle, BCardText, BCardBody, BCardFooter, BButton, BProgressBar, BProgress, BBadge, BTooltip, } from 'bootstrap-vue' import Ripple from 'vue-ripple-directive' -import store from '@/store' - -console.log(store.state.chains) export default { components: { diff --git a/src/views/Info.vue b/src/views/Info.vue index 17221f30..83f45bd7 100644 --- a/src/views/Info.vue +++ b/src/views/Info.vue @@ -1,7 +1,7 @@ @@ -13,6 +13,18 @@ export default { BCard, BCardText, }, + data() { + return { + info: 'unloaded', + } + }, + mounted() { + this.$http.get('/api/node_info', { crossdomain: true }).then(response => { + this.data.info = response.data + }).catch(e => { + this.errors.push(e) + }) + }, } diff --git a/vue.config.js b/vue.config.js index 05c180b8..7abe292e 100644 --- a/vue.config.js +++ b/vue.config.js @@ -42,13 +42,17 @@ module.exports = { } return options }) - config.module - .rule('i18n') - .resourceQuery(/blockType=i18n/) - .type('javascript/auto') - .use('i18n') - .loader('@intlify/vue-i18n-loader') - .end() }, transpileDependencies: ['vue-echarts', 'resize-detector'], + devServer: { + proxy: { + api: { + target: 'https://api.cosmos.network', + changeOrigin: true, + pathRewrite: { + '^/api': '', + }, + }, + }, + }, }