·
Vuex mutations expect two arguments ie. state and payload . The first argument is the
current state of the store and it is passed by vuex itself. Second argument is any parameters that you need
to pass. The second argument is optional.
authenticate(state, { token, expiration }) {
localStorage.setItem('token', token)
localStorage.setItem('expiration', expiration)
}
}
In the actions:
token,
expiration
})
You can also send the payload directly to action after storing payload as key array.Read more