Skip to content

Commit

Permalink
separate switching chains events in navbar
Browse files Browse the repository at this point in the history
  • Loading branch information
lukachi committed Feb 13, 2025
1 parent c798f86 commit fe48d02
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/common/NetworkSwitch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ const safeSelectNetwork = (chainId: string) => {
if (String(web3ProvidersStore.provider.chainId) === chainId) return
web3ProvidersStore.provider.selectChain(chainId)
bus.emit(BUS_EVENTS.navbarChainSwitched, chainId as EthereumChains)
}
const mainnetItems = computed<Link[]>(() => {
Expand All @@ -111,6 +110,10 @@ const mainnetItems = computed<Link[]>(() => {
router.push(route)
}
bus.emit(
BUS_EVENTS.navbarChainSwitched,
forCurrentRouteChainsLimitedByMainnet[0] as EthereumChains,
)
safeSelectNetwork(forCurrentRouteChainsLimitedByMainnet[0])
},
},
Expand All @@ -128,6 +131,7 @@ const mainnetItems = computed<Link[]>(() => {
router.push(route)
}
bus.emit(BUS_EVENTS.navbarChainSwitched, el)
safeSelectNetwork(el)
},
}
Expand All @@ -152,6 +156,10 @@ const testnetItems = computed<Link[]>(() => {
router.push(route)
}
bus.emit(
BUS_EVENTS.navbarChainSwitched,
forCurrentRouteChainsLimitedByTestnet[0],
)
safeSelectNetwork(forCurrentRouteChainsLimitedByTestnet[0])
},
},
Expand All @@ -169,6 +177,7 @@ const testnetItems = computed<Link[]>(() => {
router.push(route)
}
bus.emit(BUS_EVENTS.navbarChainSwitched, el)
safeSelectNetwork(el)
},
}
Expand Down

0 comments on commit fe48d02

Please sign in to comment.