Skip to content

Commit

Permalink
fix: wallet 当上次用户pn未断开连接,当前登录用户无aa地址时处理逻辑(断开连接)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenweigh committed Oct 15, 2024
1 parent f11224e commit 943765b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions xterio-wallet/src/contexts/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ const WalletContextProvider: React.FC<PropsWithChildren<IXterioWalletContextProp
const _uuid = info?.uuid
const pn_jwt_id = _p?.jwt_id

//1.当前用户无aa地址,上次登录用户有地址且pn已连接,断开连接
//2.当前用户有aa地址
//2.1 pn未连接,去连
//2.2 pn已连接,与上次登录用户不一致,断开重连
if (XterioAuth.isLogin && _addr) {
XLog.debug('init logic', isPnLoginedRef.current, _uuid, pn_jwt_id)
if (!isPnLoginedRef.current) {
Expand All @@ -174,6 +178,9 @@ const WalletContextProvider: React.FC<PropsWithChildren<IXterioWalletContextProp
await disconnectWallet()
await connectWallet()
}
} else if (XterioAuth.isLogin && !_addr && isPnLoginedRef.current) {
XLog.debug('init logic', isPnLoginedRef.current, 'aa address is null only disconnect')
await disconnectWallet()
}
},
[_p?.jwt_id, connectWallet, disconnectWallet]
Expand Down

0 comments on commit 943765b

Please sign in to comment.