showrooms.js 795 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import { JSONAPI } from 'vuejs/api/json-axios'
  2. import { REST } from 'vuejs/api/rest-axios'
  3. import { MA } from 'vuejs/api/ma-axios'
  4. import qs from 'querystring-es3'
  5. export default {
  6. namespaced: true,
  7. // initial state
  8. state : {
  9. items: [],
  10. },
  11. // getters
  12. getters : {},
  13. // mutations
  14. mutations : {
  15. setItems (state, items) {
  16. state.items = state.items.concat(items)
  17. }
  18. },
  19. // actions
  20. actions : {
  21. getItems({ dispatch, commit, state }){
  22. REST.get(`/showrooms_rest?_format=json`, {})
  23. .then(({ data }) => {
  24. console.log('showrooms REST: data', data)
  25. commit('setItems',data)
  26. })
  27. .catch(( error ) => {
  28. console.warn('Issue with showrooms', error)
  29. Promise.reject(error)
  30. })
  31. }
  32. }
  33. }