Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Including local storage as fallback #762

Merged
merged 1 commit into from
Oct 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading