Trying to avoid window.reload() after login/register - Apollo GraphQL Client

Viewed 128

I'm using Apollo GraphQL Client to develop my client app, and I implemented an authentication process using JWT that stored in Local Storage.

I have the following issue:

In order to make ApolloProvider to retrieve the token before it sends it to the server, I'm using the window.reload() function, beacuse the ApolloProvider is wrapping the whole application.

This solution is not optimal because we are not supposed to reload a page in SPA, which also causing my app to make an unnecessary network request after the login process and before the reload.

I'm looking for a better solution, thanks in advance for any help!

0 Answers
Related