diff --git a/src/auth/store.js b/src/auth/store.js index 64cf2c8..15358b9 100644 --- a/src/auth/store.js +++ b/src/auth/store.js @@ -15,10 +15,14 @@ const auth = { mutations: { update (state, data) { - state = Object.assign({}, defaults, data) + Object.keys(state).forEach(index => { + state[index] = data[index] + }) }, clear (state) { - state = Object.assign(state, defaults) + Object.keys(state).forEach(index => { + state[index] = defaults[index] + }) } }, diff --git a/src/store/common.js b/src/store/common.js index ac6e524..756a928 100644 --- a/src/store/common.js +++ b/src/store/common.js @@ -54,7 +54,9 @@ export default { }, clear (state) { - state = Object.assign({}, defaults) + Object.keys(state).forEach(index => { + state[index] = defaults[index] + }) } },