Interesting timing with coming across this article for me. I have started developing re-designing our site frontend to use Vue with Vuex and the point this author makes about where to put the API logic also made me scratch my head a bit. Sometimes I just need to make a simple API call that does not alter the application state and just needs to grab some information and render said information in 1 component. Technically, in the component, I can just call Axios and get the data then and there, but then I have other components such as the Login that does need to set some Vuex state and therefore that's abstracted away further in the actions/API class as all documentation seems to suggest that's what you should do. I suppose I am just finding it a bit of a challenge to keep things a) consistent and b) not overly abstracted for the task at hand.
I think the answer is that there is no right or wrong answer. Something that has worked well for me was to put my API calls in a seperate module and call this module whenever I need it (either in Vuex or a Vue component). Very simple.
I think the most important thing is to be consistent, instead of having a mix of API logic that originates from components and from the store. And since there are certain types of higher-level logic that are very difficult to house inside components, I have found that having your store be the origin for _all_ API-related logic is the best way to go, even if it seems overkill for simple things. It's better to be globally consistent than to try to have the simplest solution for every individual case.
(Disclaimer: I use React/Redux and not Vue/Vuex, but I think the above applies equally to both.)
This is essentially my chain of thought and what I have done. Even if it is a simple request that is confined to a single component when a developer looks at the codebase they can know that all API calls are called from Vuex modules and not modules _and_ components.
That then leads me to my next question though, if I am using Vuex to abstract the API calls is it bad practice to use Vuex actions for API calls that don't need to be saved into the store?
I don't think it's bad at all to have an action trigger an API call that doesn't save anything to the store. However, as @mmcnl said in response to your original comment, you probably want to abstract the actual API-related code into its own module, so that you don't implement the API calls in the actions; then your actions become thin functions that simply call that code with the necessary parameters.
This doesn't actually solve the dilemma of where to put the logic—all you've done is moved the API code into its own object, but your component is still the one controlling the higher-level flow in this case.
Spent 9 months of the year developing a REST API for a project that is launching in the coming months whilst finishing my CS degree online (finish in May). Have learned a lot along the way, mainly more about the HTTP protocol in general but also unit testing and working with third-party contractors that are building SDK's to interface with my API. All in all been a very challenging year professionally but have learned a lot of lessons that will help in the years ahead.
Was a paying Spotify user for about two years and recently jumped ship to Google Play Music to give it a shot and I'm pretty happy about it thus far. Haven't been any songs that I had on my Spotify playlist that I couldn't find. There is a few things it is missing that's not ideal (no podcasts in Australia) but the bundling of YouTube Red with the subscription + the ability to upload my bandcamp-downloaded tracks that I can stream back that aren't on either Spotify or Google Play Music is fantastic.
Podcasts is just the main thing I am wanting at the moment, but I can still access them via the Spotify free account.
I'll never understand locking people up for having an addiction and treating them like criminals. I'm not too educated on how it's handled in America but in Australia you can go to your doctors and get signed up to a methadone program without worrying about any legal repercussions.
My fiancé works at a pharmacy in Melbourne, Australia and says some of the most lovely and friendly people who just want to get themselves together come in regularly to get their $5 dose and it's saddening to see how badly society judges them.
I believe you can do the same here, but the (huge, purpose-defeating) difference is that you need to be able to afford the rehab in a country that isn't so keen on providing a safety net (somewhere upthread someone mentions his sister ruining her life with heroin, wanting to go to rehab, but unable to afford the cost, which is uncovered by Medi-Cal).
I've only been programming professionally for a year but can't see myself wanting to get out of it anytime soon, maybe ask me in 10 years to see if that view changes. But at the moment am thoroughly enjoying learning as much as I can - coming from a job I didn't enjoy as a full time baker to having my weekends back, normal social hours and just having more spring in my step by doing something I have a genuine passion for is a great feeling.
Discover weekly is hit and miss for me. Some weeks I find plenty of great material, and others I find a lot of junk - that being said I can understand it would be hard to match music you'd like all the time.