Skip to content

Commit

Permalink
test: add log
Browse files Browse the repository at this point in the history
  • Loading branch information
wenty22 committed Aug 7, 2023
1 parent 9650643 commit c2e42cc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
10 changes: 3 additions & 7 deletions apps/dcellar-web-ui/src/context/LoginContext/provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export function LoginContextProvider(props: PropsWithChildren<LoginContextProvid

const logout = useCallback(
(removeSpAuth = false) => {
console.log('LoginContextProvider: ','logout')

dispatch(resetUploadQueue({loginAccount}))
dispatch(setLogout(removeSpAuth));
disconnect();
Expand All @@ -39,19 +41,16 @@ export function LoginContextProvider(props: PropsWithChildren<LoginContextProvid
}, [logout]);

useWalletSwitchAccount(() => {
console.log('useWalletSwitchAccount ===++')
logout();
});

const { pathname } = useRouter();
const { address: walletAddress, connector } = useAccount();

const persist = useAppSelector((root) => root.persist)

console.log('=======================')
console.log('wallet:', walletAddress)
console.log('login:', loginAccount)
console.log('connector', connector)
console.log('persist', JSON.stringify(persist))

useEffect(() => {
console.log('effect 1')
Expand All @@ -66,11 +65,8 @@ export function LoginContextProvider(props: PropsWithChildren<LoginContextProvid
// Once the wallet is connected, we can get the address
// but if wallet is locked, we can't get the connector from wagmi
// to avoid errors when using the connector, we treat this situation as logout.

console.log('effect 3')
const timer = setTimeout(() => {
if (!connector) {
console.log('effect 31')
logout()
}
}, 1000)
Expand Down
1 change: 0 additions & 1 deletion apps/dcellar-web-ui/src/store/slices/persist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ export const persistSlice = createSlice({
state.bucketSortBy = payload;
},
setLogin(state, { payload }: PayloadAction<string>) {
console.log('login:', payload)
state.loginAccount = payload;
},
setLogout(state, { payload = false }: PayloadAction<boolean>) {
Expand Down

0 comments on commit c2e42cc

Please sign in to comment.