[store] fix condition where root store is not exporting state

This commit is contained in:
Pooya Parsa 2017-05-13 23:22:37 +04:30
parent 437586d92b
commit 0220be4466

View File

@ -34,13 +34,9 @@ for (let filename of filenames) {
// createStore
export const createStore = storeData instanceof Function ? storeData : () => {
// Vuex Bug
if (storeData.state instanceof Function) {
return new Vuex.Store(Object.assign({}, storeData, {
state: storeData.state()
}))
}
return new Vuex.Store(storeData)
return new Vuex.Store(Object.assign({}, storeData, {
state: storeData.state instanceof Function ? storeData.state() : {}
}))
}
// Dynamically require module