| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- // 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 page from './modules/page'
- import post from './modules/post'
- import artist from './modules/artist'
- import episode from './modules/episode'
- import event from './modules/event'
- import exhibition from './modules/exhibition'
- import short from './modules/short'
- import technique from './modules/technique'
- import guide from './modules/guide'
- import object from './modules/object'
- import publication from './modules/publication'
- import sticky from './modules/sticky'
-
- const debug = process.env.NODE_ENV !== 'production'
-
- // Vue.config.devtools = true
-
- // Current page state
- const state = {
- title: wp.site_name,
- loading: true,
- hero: {
- url: null,
- type: null,
- text: 'sample hero text', // Does this ever display?
- playbutton: true,
- },
- currentGallery: null,
- view: 'list',
- randomPostsLoaded: false,
- randomPosts: []
- }
-
- const mutations = {
- SET_HERO(state, hero) {
- if (!hero.url) {
- console.warn('No hero url to set')
- state.hero.url = null
- state.hero.type = null
- state.hero.text = ''
- state.hero.playbutton = false
- } else {
- // console.warn('Setting hero', hero)
- state.hero.text = hero.text
- state.hero.url = hero.url
- state.hero.type = hero.heroType
-
- state.hero.playbutton = hero.heroType === 'video' ? true : false
- }
- state.loading = false
- },
- CLEAR_HERO(state) {
- state.loading = true
- state.hero = {
- url: null,
- type: null,
- text: '',
- playbutton: false,
- }
- },
- SET_GALLERY(state, idList) {
- state.gallery = idList
- },
- CLEAR_GALLERY(state) {
- state.gallery = null
- },
- STORE_FETCHED_RANDOM(state, { randomPosts }) {
- state.randomPosts = randomPosts
- },
- CLEAR_RANDOM(state) {
- state.randomPosts = []
- },
- RANDOM_LOADED(state, val) {
- state.randomPostsLoaded = val
- },
- }
-
- const store = new Vuex.Store({
- actions,
- getters,
- mutations,
- state,
- modules: {
- post,
- page,
- artist,
- episode,
- event,
- exhibition,
- short,
- technique,
- guide,
- object,
- publication,
- sticky,
- },
- strict: debug,
- })
-
- export default store
|