123456789101112131415161718192021222324252627282930313233343536373839404142 |
- // import { JSONAPI } from 'vuejs/api/json-axios'
- import { REST } from 'vuejs/api/rest-axios'
- // import { MA } from 'vuejs/api/ma-axios'
- // import qs from 'querystring-es3'
- export default {
- namespaced: true,
- // initial state
- state: {
- items: [],
- showrooms_by_tid: {}
- },
- // getters
- getters: {},
- // mutations
- mutations: {
- setItems (state, items) {
- state.items = state.items.concat(items)
- items.forEach((item, i) => {
- state.showrooms_by_tid[item.tid] = item
- })
- }
- },
- // actions
- actions: {
- getItems ({ dispatch, commit, state }) {
- REST.get('/showrooms_rest?_format=json', {})
- .then(({ data }) => {
- console.log('showrooms REST: data', data)
- commit('setItems', data)
- })
- .catch((error) => {
- console.warn('Issue with showrooms', error)
- Promise.reject(error)
- })
- }
- }
- }
|