Skip to content

Commit

Permalink
feat: Improve default disconnection behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
wottpal committed May 12, 2023
1 parent 9d6e4bc commit aa2f9e1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ export const UseInkathonProvider: FC<UseInkathonProviderProps> = ({
console.error('Error while connecting wallet:', e)
setActiveExtension(undefined)
setActiveSigner(undefined)
setIsConnected(false)
} finally {
setIsConnecting(false)
}
Expand All @@ -247,10 +248,12 @@ export const UseInkathonProvider: FC<UseInkathonProviderProps> = ({
}, [api, activeSigner])

// Disconnect
const disconnect = async () => {
await api?.disconnect()
const disconnect = async (disconnectApi?: boolean) => {
if (disconnectApi) {
await api?.disconnect()
setIsInitialized(false)
}
setIsConnected(false)
setIsConnecting(false)
updateAccounts([])
unsubscribeAccounts?.()
setUnsubscribeAccounts(undefined)
Expand Down

0 comments on commit aa2f9e1

Please sign in to comment.