Be strict about putting changes in mutations.
This commit is contained in:
parent
e892fffda7
commit
ae388d7927
2 changed files with 7 additions and 3 deletions
|
@ -38,7 +38,8 @@ const store = new Vuex.Store({
|
||||||
api: apiModule,
|
api: apiModule,
|
||||||
config: configModule
|
config: configModule
|
||||||
},
|
},
|
||||||
plugins: [createPersistedState(persistedStateOptions)]
|
plugins: [createPersistedState(persistedStateOptions)],
|
||||||
|
strict: process.env.NODE_ENV !== 'production'
|
||||||
})
|
})
|
||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
|
|
|
@ -33,6 +33,9 @@ export const mutations = {
|
||||||
},
|
},
|
||||||
addNewUsers (state, users) {
|
addNewUsers (state, users) {
|
||||||
each(users, (user) => mergeOrAdd(state.users, user))
|
each(users, (user) => mergeOrAdd(state.users, user))
|
||||||
|
},
|
||||||
|
setUserForStatus (state, status) {
|
||||||
|
status.user = find(state.users, status.user)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,11 +57,11 @@ const users = {
|
||||||
|
|
||||||
// Reconnect users to statuses
|
// Reconnect users to statuses
|
||||||
each(statuses, (status) => {
|
each(statuses, (status) => {
|
||||||
status.user = find(store.state.users, status.user)
|
store.commit('setUserForStatus', status)
|
||||||
})
|
})
|
||||||
// Reconnect users to retweets
|
// Reconnect users to retweets
|
||||||
each(compact(map(statuses, 'retweeted_status')), (status) => {
|
each(compact(map(statuses, 'retweeted_status')), (status) => {
|
||||||
status.user = find(store.state.users, status.user)
|
store.commit('setUserForStatus', status)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
loginUser (store, userCredentials) {
|
loginUser (store, userCredentials) {
|
||||||
|
|
Loading…
Reference in a new issue