Vue3 add a global plugin after login or after a certain page

Viewed 84

Libraries: Vue3 and Apollo Client v3

Problem:

I am working on a project which has a login page and a protected page. In the current Vue setup, you create Apollo provider and then use Vue.use(apolloProvider) which initializes the client.

What I want to achieve, initialize Apollo provider only after the user has logged in as the Authorization header is required to be passed to graphql endpoints. Based on documentation it doesn't seem like there is an option to do so. The reason to do so is, authentication is a separate service at the moment.

0 Answers
Related