Malik
What is "The Nuxt Way" (TM) to abstract http libs?
Changing your example to what I had before
Results in what I struggled with
Oh my, I should have thought of that.
Well, thanks a bunch @manniL / TheAlexLichter, you just solved my case. I am flabbergasted.
12 replies
What is "The Nuxt Way" (TM) to abstract http libs?
Uh nice!!! I am not sure if I get that correctly, but what solves this is that using a function instead of an object when calling defineStore and inside that function I get access to useNuxtApp(), am I right? Just to understand why this works now 😄
12 replies
What is "The Nuxt Way" (TM) to abstract http libs?
Thank you @manniL / TheAlexLichter for the super fast support :). I figure that you use a similar approach as I had in mind with my setup, but if I didn't miss it, I see no usage of your plugin from within a pinia store. While I am not necessarily saying that it is generally my preferred approach to make http requests from store actions, I see it quite a lot. My custom http plugin approach, however, was not usable from within a pinia store file. Do you have a suggestion for that? I believe what bites me is the access to the runtime Config and the wrong context I am trying to access it in.
EDIT: If the answer is "making http requests in store actions is an anti-pattern" then I could live with that, too 😄
12 replies