You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I have been stuck for a day about this issue and wanted the help of the community.
I use a vuejs ( v3.3.9 )SPA with Vite ( v5.0.12 ) and
apollo/client v3.9.8
vue/apollo-composable v4.0.2
vue router v4.2.5
My goal is to execute a graphql query inside the global guard beforeEach to fetch some data before returning the next() function.
The problem is, I want to use async await in order to "block" the hook beforeEach but the query return the first time an object with { loading: true, partial: true }, so in the beforeEach I need to call two times apolloClient in order to have the data.
I didn't find any clear documentation about this in the repository, if someone can help I will update the documentation with the response.
Thank you for your times.
Edit :
I created a repository with an example of how you can use make a query inside the the global guard of vue router :
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello, I have been stuck for a day about this issue and wanted the help of the community.
I use a vuejs ( v3.3.9 )SPA with Vite ( v5.0.12 ) and
My goal is to execute a graphql query inside the global guard
beforeEach
to fetch some data before returning thenext()
function.The problem is, I want to use async await in order to "block" the hook
beforeEach
but the query return the first time an object with{ loading: true, partial: true }
, so in thebeforeEach
I need to call two times apolloClient in order to have the data.I didn't find any clear documentation about this in the repository, if someone can help I will update the documentation with the response.
Thank you for your times.
Edit :
I created a repository with an example of how you can use make a query inside the the global guard of vue router :
https://github.com/CMarzin/vue-apollo-with-vue-router
Edit 2 :
My problem was my implementation of Keycloak, the token was undefined in my router so the request failed silently without any explanation
Beta Was this translation helpful? Give feedback.
All reactions