NEXT craftinamerica.org. Base setup for headless wordpress https://www.craftinamerica.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. // SHAMELESS THEFT: https://github.com/EvanAgee/vuejs-wordpress-theme-starter
  2. import Vuex from 'vuex'
  3. import * as actions from './actions'
  4. import * as getters from './getters'
  5. import pages from './modules/page'
  6. import posts from './modules/post'
  7. import artists from './modules/artist'
  8. import episodes from './modules/episode'
  9. import events from './modules/event'
  10. import exhibitions from './modules/exhibition'
  11. const debug = process.env.NODE_ENV !== 'production'
  12. // Vue.config.devtools = true
  13. // Current page state
  14. const state = {
  15. title: wp.site_name,
  16. hero: {
  17. url: null,
  18. type: null,
  19. text: 'sample hero text',
  20. playbutton: true,
  21. },
  22. currentGallery: null,
  23. view: 'list',
  24. }
  25. const mutations = {
  26. SET_HERO(state, hero) {
  27. if (!hero) return
  28. console.log(hero)
  29. if (hero.url) {
  30. state.hero.text = state.hero.url = hero.url
  31. state.hero.type = hero.type
  32. state.hero.playbutton = hero.type === 'video' ? true : false
  33. } else {
  34. state.hero.text = hero
  35. }
  36. },
  37. CLEAR_HERO(state) {
  38. state.hero = {
  39. url: null,
  40. type: null,
  41. text: 'sample hero text',
  42. playbutton: false,
  43. }
  44. },
  45. SET_GALLERY(state, idList) {
  46. state.gallery = idList
  47. },
  48. CLEAR_GALLERY(state) {
  49. state.gallery = null
  50. },
  51. }
  52. const store = new Vuex.Store({
  53. actions,
  54. getters,
  55. mutations,
  56. state,
  57. modules: {
  58. posts,
  59. pages,
  60. artists,
  61. episodes,
  62. events,
  63. exhibitions,
  64. },
  65. strict: debug,
  66. })
  67. export default store