From 73f561764b9272fb4bd3aea6e8c5b8de405aae5f Mon Sep 17 00:00:00 2001 From: Sammy Teillet Date: Mon, 22 Jan 2024 14:36:08 +0100 Subject: [PATCH] feature: use arrow function to get token from storage for each request --- src/apollo.client.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/apollo.client.ts b/src/apollo.client.ts index 878d7d6..a7174e7 100644 --- a/src/apollo.client.ts +++ b/src/apollo.client.ts @@ -30,13 +30,12 @@ export const createApolloClient = (httpUrl: string) => { }; }); - //@Samox TODO make sure the WSlink uses the accesstoken right after it is created or refreshed const wsLink = new GraphQLWsLink( createClient({ url: wsUrl, - connectionParams: { + connectionParams: () => ({ authToken: localStorage.getItem(ACCESS_TOKEN_KEY), - }, + }), }) );