15 lines
593 B
TypeScript
15 lines
593 B
TypeScript
import { Dispatch } from '@reduxjs/toolkit'
|
|
import { clearUserInfo } from 'state/actions'
|
|
import { connectorLocalStorageKey } from '@pancakeswap/uikit'
|
|
import { connectorsByName } from './web3React'
|
|
|
|
export const clearUserStates = (dispatch: Dispatch<any>) => {
|
|
dispatch(clearUserInfo())
|
|
// This localStorage key is set by @web3-react/walletconnect-connector
|
|
if (window?.localStorage?.getItem('walletconnect')) {
|
|
connectorsByName.walletconnect.close()
|
|
connectorsByName.walletconnect.walletConnectProvider = null
|
|
}
|
|
window?.localStorage?.removeItem(connectorLocalStorageKey)
|
|
}
|