Skip to content

Commit

Permalink
Merge pull request #762 from telosnetwork/hotfix-router
Browse files Browse the repository at this point in the history
Including local storage as fallback
  • Loading branch information
poplexity committed Oct 3, 2023
2 parents 30ac6bf + 27bd804 commit 38dfcbe
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ export default route<StateInterface>(function (/* { store, ssrContext } */) {
path: 'network',
query: to.query,
});
} else if (selectedChainOnStore) { // if there is no network param and local storage has current network
return ({
path: 'network',
query: {
network: selectedChainOnStore,
},
});
} else if (preferredChainName) { // if there is no network param and local storage has preferred network selected
updateSelectedChain(preferredChainName);
return ({
Expand All @@ -59,7 +66,15 @@ export default route<StateInterface>(function (/* { store, ssrContext } */) {
// else, will proceed to home page
} else {
if (!to.query.network) { // if doesn't have network param
if (preferredChainName) { // if has a preferred chain selected on sotre
if (selectedChainOnStore) {
return ({
...to,
query: {
...to.query,
network: selectedChainOnStore,
},
});
} else if (preferredChainName) { // if has a preferred chain selected on sotre
updateSelectedChain(preferredChainName);
return ({
...to,
Expand Down

0 comments on commit 38dfcbe

Please sign in to comment.