mirror of
https://github.com/oceanprotocol/commons.git
synced 2023-03-15 18:03:00 +01:00
survive metamask failure to login
This commit is contained in:
parent
85304c2d09
commit
9e7df28b89
@ -139,6 +139,19 @@ export default class UserProvider extends PureComponent<{}, UserProviderState> {
|
||||
}
|
||||
}
|
||||
|
||||
private loadDefaultWeb3 = async () => {
|
||||
this.setState(
|
||||
{
|
||||
isLogged: false,
|
||||
isBurner: false,
|
||||
web3: DEFAULT_WEB3
|
||||
},
|
||||
() => {
|
||||
this.loadOcean()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
private loadOcean = async () => {
|
||||
const { ocean } = await provideOcean(this.state.web3)
|
||||
this.setState({ ocean, isLoading: false }, () => {
|
||||
@ -169,26 +182,11 @@ export default class UserProvider extends PureComponent<{}, UserProviderState> {
|
||||
}
|
||||
)
|
||||
} else {
|
||||
this.loadOcean()
|
||||
this.loadDefaultWeb3()
|
||||
}
|
||||
break
|
||||
case 'BurnerWallet':
|
||||
const burnerWalletProvider = new BurnerWalletProvider()
|
||||
if (await burnerWalletProvider.isLogged()) {
|
||||
await burnerWalletProvider.startLogin()
|
||||
this.setState(
|
||||
{
|
||||
isLogged: true,
|
||||
isBurner: true,
|
||||
web3: burnerWalletProvider.getProvider()
|
||||
},
|
||||
() => {
|
||||
this.loadOcean()
|
||||
}
|
||||
)
|
||||
} else {
|
||||
this.loginBurnerWallet()
|
||||
}
|
||||
this.loginBurnerWallet()
|
||||
break
|
||||
default:
|
||||
this.loginBurnerWallet()
|
||||
|
Loading…
Reference in New Issue
Block a user