Skip to content
This repository was archived by the owner on May 13, 2024. It is now read-only.

Commit 08d3a47

Browse files
fix: testcase for useAuthContext
1 parent 6af3e70 commit 08d3a47

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/configs/websocket/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,15 @@ export class ApiManager {
7373
clearInterval(this.reconnectInterval);
7474
}
7575
this.socket.addEventListener('open', () => {
76-
this.websocket_connected(true);
76+
this.websocket_connected && this.websocket_connected(true);
7777
this.pingInterval = setInterval(() => {
7878
this.socket.send(JSON.stringify({ ping: 1 }));
7979
}, PING_INTERVAL);
8080
});
8181

8282
this.socket.onclose = () => {
83-
this.websocket_connected(false);
84-
this.websocket_authorize(false);
83+
this.websocket_connected && this.websocket_connected(false);
84+
this.websocket_authorize && this.websocket_authorize(false);
8585
clearInterval(this.pingInterval);
8686
this.socket = null;
8787
if (attempts > 0) {

src/contexts/auth/auth.provider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const AuthProvider = ({ children }: TAuthProviderProps) => {
6363
if (!is_authorized && is_connected) {
6464
updateAuthorize();
6565
}
66-
}, [is_authorized, is_connected]);
66+
}, [is_authorized, is_connected, updateAuthorize]);
6767

6868
const updateLoginAccounts = useCallback(
6969
(loginAccounts: IUserLoginAccount[]) => {

0 commit comments

Comments
 (0)