Answer the question
In order to leave comments, you need to log in
What are the patterns for working with APIs from Vue and Vuex Store through a class object?
I wrote a class for working with the API, the specifics of the work is that at the first start the key comes from the attribute, then with each request a new key comes in the response. To implement the algorithm, I save the key in the class object + the request queue in the same place. The class object was written to the application in the $API variable so that it would be available from all components.
Next, it was necessary to connect the Vuex shared storage and pull the API from the storage events. Ideally, somehow pass this object globally to the store, but Vuex plugins and mixins work differently and do not allow you to create a global variable.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question