-
-
Notifications
You must be signed in to change notification settings - Fork 522
-
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 :
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.