right now when i use the Realm Web SDK with the Apollo GraphQL JS client, i must write the following boilerplate code to construct the HttpLink instance:
const client = new ApolloClient({
link: new HttpLink({
uri: process.env.NEXT_PUBLIC_GRAPHQL_API_ENDPOINT,
// We get the latest access token on each request
fetch: async (uri, options) => {
const accessToken = app?.currentUser?.accessToken;
options.headers.Authorization = `Bearer ${accessToken}`;
return fetch(uri, options);
},
}),
cache: new InMemoryCache(),
});
i would like if this boilerplate could be replaced with a built-in member of the realm-web package.
Solution
implement something like User.ApolloHttpLink, so i could replace the above code with something like:
const client = new ApolloClient({
link: new user.ApolloHttpLink(),
cache: new InMemoryCache(),
});
Problem
right now when i use the Realm Web SDK with the Apollo GraphQL JS client, i must write the following boilerplate code to construct the HttpLink instance:
i would like if this boilerplate could be replaced with a built-in member of the
realm-web
package.Solution
implement something like
User.ApolloHttpLink
, so i could replace the above code with something like:How important is this improvement for you?
I'd like to see it, but have a workaround