Answer the question
In order to leave comments, you need to log in
How to mutate vue store asynchronously?
Tell people in the know, please.
I need to pre-load data from the API, I have an async function with a request via axios, this function is imported in other files and this data is manipulated and after that I pass the data through mutations to the vue store.
When I just wrote all this, I stored the data in localStorage and everything was fine, now I take the same data from the API and everything fell apart, because export default at the very end where the mutation occurs immediately, without waiting for what happens above .
Is there a solution?
Answer the question
In order to leave comments, you need to log in
Mutations cannot be asynchronous, they are only needed to set the data in the store. Do all asynchronous work in actions, then call mutation commits from there
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question