This is a great question an, probably, deserves a entire post. Hopefully, I will find time soon to write one and explain everything in details 😊
But the short answer is that it’s all about provider. Instead of actual data, you inject axios instance into the service with the help of provider. And then service simply invokes axios methods. Consider this code:
First, we update the service interface. Since we are making API call, service methods become async.
Then we update Service to expect Axios instance to be injected at a construction time. And we use this instance to make actual calls.
Finally, we inject axios into the service in the provider.
Of course, there have to be many changes to be made. We would have to test the Service slightly differently, we would have to update everything that depends on the Service (the Store, in our case). But I hope you have a gist of the idea. Don’t hesitate to ask any questions