Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

vuex add multiple payload to mutation

// call
store.commit('authenticate', {
    token,
    expiration,
});

// mutation
mutations: {
    authenticate(state, { token, expiration }) {
        localStorage.setItem('token', token);
        localStorage.setItem('expiration', expiration);
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #vuex #add #multiple #payload #mutation
ADD COMMENT
Topic
Name
7+8 =