Answer the question
In order to leave comments, you need to log in
Where to run the main action from vuex?
I have an action that gets all the information about the user from the site's API. After receiving the data, this action naturally changes the state of the application and it needs to run before the page loads in order for me to do the loading animation. I think MB in App.vue should be stuffed into created, but maybe there is something more elegant already ready for this?
Answer the question
In order to leave comments, you need to log in
Well, it's a normal choice. You can put it in a separate file so that the code looks cleaner.
If vue-router is used, then you can put a flag in the beforeEach hook so that this action is called only once.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question