diff --git a/src/commons/graphql/client.tsx b/src/commons/graphql/client.tsx index 4886c15..24d13c6 100644 --- a/src/commons/graphql/client.tsx +++ b/src/commons/graphql/client.tsx @@ -79,6 +79,9 @@ export const AppApolloClientProvider: FC = ({ children }) => { authorization: `Bearer ${accessToken}`, }, }); + const subscriptionClient = (wsLink as any) + .subscriptionClient; + subscriptionClient?.close(false, false); resolve(forward(operation)); }); logoutRef.current(); @@ -139,9 +142,9 @@ export const AppApolloClientProvider: FC = ({ children }) => { }:${window.location.port}/api/graphql`, options: { reconnect: true, - connectionParams: { + connectionParams: () => ({ authorization: `Bearer ${accessTokenRef.current} `, - }, + }), }, }); const httpLink = new HttpLink({