flaschengeist-frontend/src/store/modules/pricelist.js

38 lines
567 B
JavaScript
Raw Normal View History

2020-02-27 20:54:28 +00:00
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
}