feat: 实现订阅登录成功后自动重连
This commit is contained in:
parent
6de1f73d47
commit
c51228eff9
@ -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({
|
||||
|
Loading…
Reference in New Issue
Block a user