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

resolves #1031 #1040

Merged
merged 3 commits into from Jan 19, 2022
Merged

resolves #1031 #1040

merged 3 commits into from Jan 19, 2022

Conversation

kevinunger
Copy link
Contributor

Changes in App.vue in router watcher:

  • Check if params are in URL, if so check if chain is supported --> change network in MM and set localstorage 'currentChain'
  • If chain in params === chain in localStorage or no params given --> add params to URL

Changes in Options.vue:

  • change of chain from the options page --> add chain to params

Changes in Common.ts:

  • if change of chain comes from MM --> add chain to params

Used router.replace the way I did to avoid a refresh and to avoid the redundant navigation warning from vue-router

@github-actions github-actions bot added this to In progress in Work Flow Jan 19, 2022
@kevinunger
Copy link
Contributor Author

and @Chriserus maybe you know how to replace the (this as any).$router here
Typescript error when not doing the (this as any)-thing is this:
Property '$router' does not exist on type 'CombinedVueInstance<Vue, Data, { toggleGraphics(): void; toggleRewards(): void; toggleAdvanced(): void; onClaimTokens(): Promise<void>; claimSkill(stage: ClaimStage): Promise<...>; ... 11 more ...; fetchPartnerProjects(): Promise<...>; }, { ...; }, Readonly<...>>'.
🤷‍♂️

vuejs/vue#8721

@kevinunger
Copy link
Contributor Author

If anyone wants to test locally (on production or testnet (beware, testnet avax/polygon/oec are reaaaly slow)) change:

const env = window.location.href.startsWith('https://test') ? 'test' : 'production';
to const env = 'production'
and in contracts.ts:
(
if(process.env.NODE_ENV === 'development') return '';
const env = window.location.href.startsWith('https://test') ? 'test' : 'production';
)
comment L95
L96: const env='production'

@@ -303,6 +303,12 @@ export default Vue.extend({
async setCurrentChain() {
localStorage.setItem('currentChain', this.currentChain);
Events.$emit('setting:currentChain', { value: this.currentChain });
(this as any).$router.replace(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a router being used in common.ts without as any conversion. You could create and export a function in common.ts that will do router.replace and call it from here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked it, should work, you can also change (this as any).$router that's in NftDisplay component

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kcper @Chriserus Thanks, worked!

@kevinunger kevinunger marked this pull request as ready for review January 19, 2022 10:47
Work Flow automation moved this from In progress to Merge Ready Jan 19, 2022
@kevinunger kevinunger merged commit f542d2a into main Jan 19, 2022
Work Flow automation moved this from Merge Ready to Done - Bounty Requested Jan 19, 2022
@kcper kcper deleted the issue-1031 branch January 19, 2022 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Work Flow
Done - Bounty Requested
Development

Successfully merging this pull request may close these issues.

None yet

3 participants