38 lines
567 B
JavaScript
38 lines
567 B
JavaScript
|
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
|
||
|
}
|