mst-gql
mst-gql copied to clipboard
Add documentation around updating HttpClient
I'm starting my app with the following RootStore:
export const wrapperCreateHttpClient = () => {
return createHttpClient(GRAPHQL_URI, {
headers: {
authorization: Token.bearerString,
},
})
}
RootStore.create(defaultStoreInstance, {
gqlHttpClient: wrapperCreateHttpClient()
})
later down, if the user started unauthenticated (no bearer token stored), but receive his authentication, I'm updating the environment of the root storage:
const env = getEnv(store)
env["gqlHttpClient"] = wrapperCreateHttpClient()
yet, useQuery still uses the former gqlHttpClient that doesn't include the bearer token.
Any idea on how to resolve this?
@nicolasburtey can you check https://github.com/mobxjs/mst-gql/issues/82 and see if it solves your issue? We might need to add docs around this.
It did! can be closed on my side but some documentation around it would be nice indeed.