Install pinia stores after clientside plugins #1966
Unanswered
irakliShengelia
asked this question in
Help and Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently facing an issue - which I'm sure is due to me not understanding the lifecycle of requests in nuxt.
I have a custom api client, which needs to use the window url to configure itself - I'm doing this via plugin 'apiUrlSetter', which returns:
return { provide: { apiV1: apiV1 } }
I need to use this client for making a login request, which I'm doing through an action in pinia (login).
My issue is that auth.js store is initiated before apiV1 is injected into context, so I'm unable to make a request.
In a weird case - in a different store 'school.js' - it works as expected.
I can't figure out what dictates the execution order:
Any help appreciated [maybe docs of nuxtjs request lifecycle?]
Summary: how do I run apiUrlSetter, before auth.js store install?
Beta Was this translation helpful? Give feedback.
All reactions