From e0697b2a6d3db8dda677f98c1b8d16c0b9c8cb82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Thu, 27 Feb 2020 21:54:28 +0100 Subject: [PATCH] finished ##172 --- src/components/pricelist/PriceList.vue | 125 +++++++++++++++++++++++++ src/plugins/routes.js | 1 + src/router/index.js | 6 ++ src/store/index.js | 4 +- src/store/modules/pricelist.js | 37 ++++++++ 5 files changed, 172 insertions(+), 1 deletion(-) create mode 100644 src/components/pricelist/PriceList.vue create mode 100644 src/store/modules/pricelist.js diff --git a/src/components/pricelist/PriceList.vue b/src/components/pricelist/PriceList.vue new file mode 100644 index 0000000..5636d3b --- /dev/null +++ b/src/components/pricelist/PriceList.vue @@ -0,0 +1,125 @@ + + + + + diff --git a/src/plugins/routes.js b/src/plugins/routes.js index a9dd05f..67def58 100644 --- a/src/plugins/routes.js +++ b/src/plugins/routes.js @@ -5,6 +5,7 @@ const main = 'http://localhost:5000/' const url = { login: main + 'login', + pricelist: main + 'pricelist', getFinanzerMain: main + 'getFinanzerMain', bar: main + 'bar', barGetUser: main + 'barGetUser', diff --git a/src/router/index.js b/src/router/index.js index 8f46419..3e8c8ab 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -18,10 +18,16 @@ import ServiceManagement from '../components/vorstand/ServiceManagement' import Config from '@/components/user/Config' import Jobs from '@/components/user/Jobs' import JobRequests from '@/components/user/JobRequests' +import PriceList from "@/components/pricelist/PriceList"; Vue.use(VueRouter) const routes = [ + { + path: '/pricelist', + name: 'priceListNoLogin', + component: PriceList + }, { path: '/login', name: 'login', diff --git a/src/store/index.js b/src/store/index.js index 2890a75..0398961 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -7,6 +7,7 @@ import user from '@/store/modules/user' import sm from '@/store/modules/serviceManagement' import jobs from '@/store/modules/jobs' import requestJobs from '@/store/modules/jobRequests' +import priceList from '@/store/modules/pricelist' Vue.use(Vuex) @@ -18,6 +19,7 @@ export default new Vuex.Store({ user, sm, jobs, - requestJobs + requestJobs, + priceList } }) diff --git a/src/store/modules/pricelist.js b/src/store/modules/pricelist.js new file mode 100644 index 0000000..67f0461 --- /dev/null +++ b/src/store/modules/pricelist.js @@ -0,0 +1,37 @@ +import url from '@/plugins/routes' +import axios from 'axios' + +const state = { + priceList: [] +} + +const mutations = { + setPriceList: (state, priceList) => { + state.priceList = priceList + } +} + +const actions = { + async getPriceList({ commit }) { + try { + const response = await axios.get(url.pricelist) + commit('setPriceList', response.data) + } catch (e) { + console.log(e) + } + } +} + +const getters = { + priceList: state => { + return state.priceList + } +} + +export default { + namespaced: true, + state, + mutations, + actions, + getters +}