+91-9560121007

+1-929-243-5550

Useful Tools In Vue.js Web Development

state.user = user

actions: {

getUser({ commit }, userInfo) {

commit(‘SET_USER’, userInfo)

plugins: [createPersistedState()]

Here, we add a user state that would store user data from the form created in the previous section. We also add a SET_USER mutation that would be used in modifying the user state. Finally, we add a getUser action that would receive the user object and pass it to the SET_USER mutation property. The next would be to dispatch this action after validating our form successfully. This looks like this:

methods: {

login() {

this.submitted = true;

let invalidForm = this.$v.form.$invalid;

let form = this.form;