From c51228eff9bf575233f01cdf6adbfb71c2e369cf Mon Sep 17 00:00:00 2001 From: Ivan Li Date: Sat, 24 Jul 2021 17:37:24 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=9E=E7=8E=B0=E8=AE=A2=E9=98=85?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E6=88=90=E5=8A=9F=E5=90=8E=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E9=87=8D=E8=BF=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/commons/graphql/client.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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({