Fix state reset bug on subscription page
This commit is contained in:
parent
31f328b0ce
commit
f788be7022
3 changed files with 13 additions and 5 deletions
|
@ -176,9 +176,11 @@ function canConnectWallet(): boolean {
|
|||
}
|
||||
|
||||
function reset() {
|
||||
senderEthereumAddress = null
|
||||
subscriptionsEnabled = null
|
||||
subscription = null
|
||||
subscriptionState = null
|
||||
tokenBalance = null
|
||||
}
|
||||
|
||||
async function connectWallet() {
|
||||
|
@ -188,7 +190,11 @@ async function connectWallet() {
|
|||
}
|
||||
}
|
||||
|
||||
watch($$(walletAddress), reset)
|
||||
watch($$(walletAddress), (newValue) => {
|
||||
if (newValue === null) {
|
||||
reset()
|
||||
}
|
||||
})
|
||||
|
||||
async function checkSubscription() {
|
||||
if (
|
||||
|
|
|
@ -115,6 +115,7 @@ function canConnectWallet(): boolean {
|
|||
}
|
||||
|
||||
function reset() {
|
||||
subscriptionToken = null
|
||||
subscriptionsEnabled = null
|
||||
subscription = null
|
||||
subscriptionState = null
|
||||
|
@ -128,7 +129,11 @@ async function connectWallet() {
|
|||
}
|
||||
}
|
||||
|
||||
watch($$(walletAddress), reset)
|
||||
watch($$(walletAddress), (newValue) => {
|
||||
if (newValue === null) {
|
||||
reset()
|
||||
}
|
||||
})
|
||||
|
||||
async function checkSubscription() {
|
||||
if (
|
||||
|
|
|
@ -85,9 +85,6 @@ async function connectWallet(): Promise<void> {
|
|||
walletProvider.on("accountsChanged", () => {
|
||||
disconnectWallet()
|
||||
})
|
||||
walletProvider.on("disconnect", () => {
|
||||
disconnectWallet()
|
||||
})
|
||||
}
|
||||
|
||||
// Can't use reactive signer object because it doesn't work with ethers.js
|
||||
|
|
Loading…
Reference in a new issue