-
Notifications
You must be signed in to change notification settings - Fork 85
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
context.commit #114
Comments
I have no idea what you’re talking about. |
if I use updateField, then which method should I call in context.commit. I have an item field, what will be the name of the method that is generated automatically? |
Still no idea what you're talking about. What is context.commit?
|
`const state = { const getters = { const mutations = { const actions = { |
Create you own mutation for setting |
@heiheshang have the comments here solved your issue? |
@maoberlehner Why do you advise against using In my case, I solved it like this:
but it seems to me useless and repetitive code since in practice
equals to:
|
@aberbenni and @heiheshang The point of this library is that you don't manually call the mutations. Instead the mutations are written as setters on the aliased property in the vm root scope. So you simply set the value for that alias and the mutation is called automatically. So for example:
This will create an alias |
I try to better clarify what I'm doing, my use case is about actions where I run asynchronous code by calling external APIs with axios and then saving fetched data in my Vuex store. To do this, you need to commit mutations in an action, as reported here: https://vuex.vuejs.org/guide/actions.html Here is my code:
So how can I commit? Should I use In order to write less boilerplate code I would prefer to use |
how to do context.commit ? I used to call my method, what should I do now?
The text was updated successfully, but these errors were encountered: