Trades base

This commit is contained in:
Matthias 2020-05-04 07:28:53 +02:00
parent 1254e21cf2
commit 9e84ab1058
5 changed files with 45 additions and 3 deletions

View File

@ -14,6 +14,7 @@ module.exports = {
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off'
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
}
}

View File

@ -1,15 +1,18 @@
import Vue from 'vue'
import Vuex from 'vuex'
import tradesModule from './modules/trades';
Vue.use(Vuex)
export default new Vuex.Store({
state: {
},
modules: {
trades: tradesModule
},
mutations: {
},
actions: {
},
modules: {
}
})

View File

@ -0,0 +1,5 @@
const apiBase = '/api/v1/'
module.exports(
apiBase
)

View File

@ -0,0 +1,23 @@
import axios from 'axios';
const apiBase = require('./config.js')
export default {
namespaced: true,
state: {
trades: [],
},
mutations: {
updateTrades(state, trades) {
state.trades = trades;
}
},
actions: {
getTrades({ commit }) {
axios.get(`${apiBase}/trades`)
.then((result) => commit('updateTrades', result.data))
.catch(console.error);
}
}
};

10
vue.config.js Normal file
View File

@ -0,0 +1,10 @@
module.exports = {
devServer: {
proxy: {
'/api': {
target: 'http://localhost:8081',
changeOrigin: true,
},
},
},
};