Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to update the user on login #61

Open
adrielwerlich opened this issue Dec 28, 2018 · 0 comments
Open

how to update the user on login #61

adrielwerlich opened this issue Dec 28, 2018 · 0 comments

Comments

@adrielwerlich
Copy link

I´m trying to update the user vuex state from a Login component have here. I have very few experience with vuex so I´m little lost in the process... this is how I´m trying:

user.js

  set: (state, user) =>{
    debugger
    state.main =   Object.assign({}, state.main, user)
  }```
#actions.js

export const updateCurrentUser = ( {commit}, form ) => {

commit('setUser',form)
// context.commit('increment')
}```

#mutation-types

export const UPDATE_USER = 'UPDATE_USER'

Finally in the Login.vue component I have the login() method in which I´m trying to call the action

#Login.vue

 methods:{

    ...mapActions([
      'updateCurrentUser'
    ]),
logIn() {
        this.$store.commit() // I dont know which parameters to call here

        this.currentUser.mutations.set(this.form) // I´ve tried this, but doesn´t work
}

I don´t know if I´m following the correct method resolution order to make this work...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant