// SHAMELESS THEFT: https://github.com/EvanAgee/vuejs-wordpress-theme-starter import Vuex from 'vuex' import * as actions from './actions' import * as getters from './getters' import pages from './modules/page' import posts from './modules/post' import artists from './modules/artist' import episodes from './modules/episode' import events from './modules/event' import exhibitions from './modules/exhibition' const debug = process.env.NODE_ENV !== 'production' // Vue.config.devtools = true // Current page state const state = { title: wp.site_name, hero: { url: null, type: null, text: 'sample hero text', playbutton: true, }, currentGallery: null, view: 'list', } const mutations = { SET_HERO(state, hero) { if (!hero) return console.log(hero) if (hero.url) { state.hero.text = state.hero.url = hero.url state.hero.type = hero.type state.hero.playbutton = hero.type === 'video' ? true : false } else { state.hero.text = hero } }, CLEAR_HERO(state) { state.hero = { url: null, type: null, text: 'sample hero text', playbutton: false, } }, SET_GALLERY(state, idList) { state.gallery = idList }, CLEAR_GALLERY(state) { state.gallery = null }, } const store = new Vuex.Store({ actions, getters, mutations, state, modules: { posts, pages, artists, episodes, events, exhibitions, }, strict: debug, }) export default store