Skip to content

Commit 2e3d607

Browse files
committed
fix: ensure signOut is called only when user is signed in
1 parent f1ea843 commit 2e3d607

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/hooks/useLoginLogout.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ import { useDisconnect } from 'wagmi';
55
export function useLoginLogout() {
66
const { open } = useAppKit();
77
const { disconnectAsync } = useDisconnect();
8-
const { signOut } = useAuth()
8+
const { signOut, isSignedIn } = useAuth()
99

1010
const logout = async () => {
11-
signOut()
11+
if (isSignedIn) {
12+
signOut()
13+
}
1214
try {
1315
await disconnectAsync();
1416
} catch (err) {

0 commit comments

Comments
 (0)