feat: 实现订阅登录成功后自动重连
This commit is contained in:
parent
6de1f73d47
commit
c51228eff9
@ -79,6 +79,9 @@ export const AppApolloClientProvider: FC = ({ children }) => {
|
|||||||
authorization: `Bearer ${accessToken}`,
|
authorization: `Bearer ${accessToken}`,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
const subscriptionClient = (wsLink as any)
|
||||||
|
.subscriptionClient;
|
||||||
|
subscriptionClient?.close(false, false);
|
||||||
resolve(forward(operation));
|
resolve(forward(operation));
|
||||||
});
|
});
|
||||||
logoutRef.current();
|
logoutRef.current();
|
||||||
@ -139,9 +142,9 @@ export const AppApolloClientProvider: FC = ({ children }) => {
|
|||||||
}:${window.location.port}/api/graphql`,
|
}:${window.location.port}/api/graphql`,
|
||||||
options: {
|
options: {
|
||||||
reconnect: true,
|
reconnect: true,
|
||||||
connectionParams: {
|
connectionParams: () => ({
|
||||||
authorization: `Bearer ${accessTokenRef.current} `,
|
authorization: `Bearer ${accessTokenRef.current} `,
|
||||||
},
|
}),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const httpLink = new HttpLink({
|
const httpLink = new HttpLink({
|
||||||
|
Loading…
Reference in New Issue
Block a user