Answer the question
In order to leave comments, you need to log in
Organizing API Calls in a Vue.js Application - Vuex Actions or a Service Class?
I've always put API calls in Vuex actions, but I thought about a different approach - to organize API calls in custom service classes - one class for each entity, where each API call is a static function returning a promise. Then in the components there is a reversal of the form:
<EntityName>.<methodName>
.then((res) => {})
...
Answer the question
In order to leave comments, you need to log in
Check out this article, I liked the approach
https://medium.com/canariasjs/vue-api-calls-in-as...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question