mirror of
https://github.com/status-im/safe-react.git
synced 2025-01-12 02:54:09 +00:00
Kill walletconnect session on disconnect
This commit is contained in:
parent
e0ae8c5645
commit
beae72c471
@ -2,6 +2,7 @@
|
||||
import { createAction } from 'redux-actions'
|
||||
import type { Dispatch as ReduxDispatch } from 'redux'
|
||||
import { NOTIFICATIONS, showSnackbar } from '~/logic/notifications'
|
||||
import { getWeb3 } from '~/logic/wallets/getWeb3'
|
||||
|
||||
export const REMOVE_PROVIDER = 'REMOVE_PROVIDER'
|
||||
|
||||
@ -10,9 +11,11 @@ const removeProvider = createAction<string, *, *>(REMOVE_PROVIDER)
|
||||
export default (enqueueSnackbar: Function, closeSnackbar: Function) => (dispatch: ReduxDispatch<*>) => {
|
||||
showSnackbar(NOTIFICATIONS.WALLET_DISCONNECTED_MSG, enqueueSnackbar, closeSnackbar)
|
||||
|
||||
// remove info about current wallet connect session on disconnect so it's not used later
|
||||
// TODO: use a method for killing the session from web3connect when they provide one
|
||||
localStorage.removeItem('walletconnect')
|
||||
const web3 = getWeb3()
|
||||
|
||||
if (web3.currentProvider && web3.currentProvider.close) {
|
||||
web3.currentProvider.close()
|
||||
}
|
||||
|
||||
dispatch(removeProvider())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user