Created
June 23, 2017 10:44
-
-
Save gearmobile/fe15502f0bd988474906597fb1c56f3b to your computer and use it in GitHub Desktop.
Store optimization
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import data from '../../data/data.json' | |
const state = { | |
items: [], | |
cards: [], | |
generals: [], | |
repairs: [], | |
promotion: [] | |
} | |
const mutations = { | |
'SET_ITEMS' (state, payload) { | |
state.items = payload | |
}, | |
'SET_CARDS' (state, payload) { | |
state.cards = payload | |
}, | |
'SET_GENERALS' (state, payload) { | |
state.generals = payload | |
}, | |
'SET_REPAIRS' (state, payload) { | |
state.repairs = payload | |
}, | |
'SET_PROMOTION' (state, payload) { | |
state.promotion = payload | |
} | |
} | |
const actions = { | |
initData ({ commit }) { | |
commit('SET_ITEMS', data.primo) | |
commit('SET_CARDS', data.secondo) | |
commit('SET_GENERALS', data.tetro) | |
commit('SET_REPAIRS', data.quattro) | |
commit('SET_PROMOTION', data.cinque) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment