From 4d8a1423c3aaed39a992e4f1bb333c7c30413aaf Mon Sep 17 00:00:00 2001 From: William Chong Date: Fri, 17 Feb 2023 18:37:46 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=90=20Add=20locale=20to=20route?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/EventModal/Collect/index.vue | 22 +++++++++++-------- src/components/NFTAboutPage/index.vue | 4 +++- src/components/NFTPage/CollectorList/Item.vue | 16 ++++++++------ src/components/NFTPage/EventList/Table.vue | 10 +++++---- src/components/SettingsPageHeader.vue | 4 +++- src/components/SiteHeader.vue | 2 +- src/mixins/navigation-listener.js | 2 +- src/mixins/nft.js | 10 +++++---- src/mixins/wallet.js | 8 ++++--- .../_id/index/subscribe/_subscriptionId.vue | 10 +++++---- src/pages/dashboard/index.vue | 10 +++++---- src/pages/logout.vue | 2 +- src/pages/nft/class/_classId/_nftId.vue | 20 ++++++++++------- src/pages/nft/class/_classId/index.vue | 10 +++++---- src/pages/nft/fiat/stripe.vue | 12 +++++----- src/pages/oauth/redirect.vue | 2 +- 16 files changed, 86 insertions(+), 58 deletions(-) diff --git a/src/components/EventModal/Collect/index.vue b/src/components/EventModal/Collect/index.vue index 91726cbb2..eafa63e7e 100644 --- a/src/components/EventModal/Collect/index.vue +++ b/src/components/EventModal/Collect/index.vue @@ -326,18 +326,22 @@ export default { } }, goToNFTDetails() { - this.$router.push({ - name: 'nft-class-classId-nftId', - params: { classId: this.classId, nftId: this.justCollectedNFTId }, - }); + this.$router.push( + this.localeLocation({ + name: 'nft-class-classId-nftId', + params: { classId: this.classId, nftId: this.justCollectedNFTId }, + }) + ); this.uiCloseTxModal(); }, goToPortfolio() { - this.$router.push({ - name: 'id', - params: { id: this.getAddress }, - query: { tab: 'collected' }, - }); + this.$router.push( + this.localeLocation({ + name: 'id', + params: { id: this.getAddress }, + query: { tab: 'collected' }, + }) + ); this.uiCloseTxModal(); }, onClickModelViewer() { diff --git a/src/components/NFTAboutPage/index.vue b/src/components/NFTAboutPage/index.vue index 566eba3a9..5bbcf0d19 100644 --- a/src/components/NFTAboutPage/index.vue +++ b/src/components/NFTAboutPage/index.vue @@ -216,7 +216,9 @@ export default { ); }, handleCollect(classId) { - this.$router.push({ name: 'writing-nft', hash: `#${classId}` }); + this.$router.push( + this.localeLocation({ name: 'writing-nft', hash: `#${classId}` }) + ); }, handleCollectFromWidgetSection(classId) { logTrackerEvent(this, 'NFTAboutPage', 'GoToCampaign(Widget)', classId, 1); diff --git a/src/components/NFTPage/CollectorList/Item.vue b/src/components/NFTPage/CollectorList/Item.vue index 69b740866..0c7f58d05 100644 --- a/src/components/NFTPage/CollectorList/Item.vue +++ b/src/components/NFTPage/CollectorList/Item.vue @@ -45,13 +45,15 @@ export default { }, methods: { handleRowClick() { - this.$router.push({ - name: 'nft-class-classId-nftId', - params: { - classId: this.classId, - nftId: this.owner.collectedFirstNFTId, - }, - }); + this.$router.push( + this.localeLocation({ + name: 'nft-class-classId-nftId', + params: { + classId: this.classId, + nftId: this.owner.collectedFirstNFTId, + }, + }) + ); }, }, }; diff --git a/src/components/NFTPage/EventList/Table.vue b/src/components/NFTPage/EventList/Table.vue index b741c49a3..83ffec229 100644 --- a/src/components/NFTPage/EventList/Table.vue +++ b/src/components/NFTPage/EventList/Table.vue @@ -158,10 +158,12 @@ export default { methods: { getChainExplorerTx, handleRowClick(event) { - this.$router.push({ - name: event.nftId ? 'nft-class-classId-nftId' : 'nft-class-classId', - params: { classId: event.classId, nftId: event.nftId }, - }); + this.$router.push( + this.localeLocation({ + name: event.nftId ? 'nft-class-classId-nftId' : 'nft-class-classId', + params: { classId: event.classId, nftId: event.nftId }, + }) + ); }, }, }; diff --git a/src/components/SettingsPageHeader.vue b/src/components/SettingsPageHeader.vue index fadf37ad9..884fab1ca 100644 --- a/src/components/SettingsPageHeader.vue +++ b/src/components/SettingsPageHeader.vue @@ -73,7 +73,9 @@ export default { .split('-') .slice(0, -1) .join('-'); - if (backRouteName) this.$router.push({ name: backRouteName }); + if (backRouteName) { + this.$router.push(this.localeLocation({ name: backRouteName })); + } }, }, }; diff --git a/src/components/SiteHeader.vue b/src/components/SiteHeader.vue index da362f929..d87ea12ab 100644 --- a/src/components/SiteHeader.vue +++ b/src/components/SiteHeader.vue @@ -15,7 +15,7 @@ > diff --git a/src/mixins/navigation-listener.js b/src/mixins/navigation-listener.js index f249856b1..6bb1eeba3 100644 --- a/src/mixins/navigation-listener.js +++ b/src/mixins/navigation-listener.js @@ -20,7 +20,7 @@ export default { event.data.type === 'navigate' && event.data.route ) { - this.$router.push(event.data.route); + this.$router.push(this.localeLocation(event.data.route)); } }, }, diff --git a/src/mixins/nft.js b/src/mixins/nft.js index 941b3a370..6ab4b3877 100644 --- a/src/mixins/nft.js +++ b/src/mixins/nft.js @@ -880,10 +880,12 @@ export default { } }, goNFTDetails() { - this.$router.push({ - name: 'nft-class-classId', - params: { classId: this.classId }, - }); + this.$router.push( + this.localeLocation({ + name: 'nft-class-classId', + params: { classId: this.classId }, + }) + ); }, normalizeNFTMessage(m) { if (m.memo === 'like.co NFT API') return ''; diff --git a/src/mixins/wallet.js b/src/mixins/wallet.js index 0e4e2d7a0..a873debb5 100644 --- a/src/mixins/wallet.js +++ b/src/mixins/wallet.js @@ -81,9 +81,11 @@ export default { this.navigateToMyDashboard(); } } else { - this.$router.push({ - name: 'dashboard', - }); + this.$router.push( + this.localeLocation({ + name: 'dashboard', + }) + ); } }, navigateToSettings() { diff --git a/src/pages/_id/index/subscribe/_subscriptionId.vue b/src/pages/_id/index/subscribe/_subscriptionId.vue index b136a5e4a..640dda419 100644 --- a/src/pages/_id/index/subscribe/_subscriptionId.vue +++ b/src/pages/_id/index/subscribe/_subscriptionId.vue @@ -132,10 +132,12 @@ export default { methods: { ...mapActions(['lazyGetUserInfoByAddress']), handleClickClose() { - this.$router.replace({ - name: 'id', - params: { id: this.wallet }, - }); + this.$router.replace( + this.localeLocation({ + name: 'id', + params: { id: this.wallet }, + }) + ); }, handleClickConfirm() { return this.isSubscribePage diff --git a/src/pages/dashboard/index.vue b/src/pages/dashboard/index.vue index 293f091d9..d7eb8350d 100644 --- a/src/pages/dashboard/index.vue +++ b/src/pages/dashboard/index.vue @@ -238,10 +238,12 @@ export default { }, goMyPortfolio() { logTrackerEvent(this, 'MyDashboard', 'GoToMyPortfolio', this.wallet, 1); - this.$router.push({ - name: 'id', - params: { id: this.wallet }, - }); + this.$router.push( + this.localeLocation({ + name: 'id', + params: { id: this.wallet }, + }) + ); }, }, }; diff --git a/src/pages/logout.vue b/src/pages/logout.vue index 21e33f8f0..60a91b7b5 100644 --- a/src/pages/logout.vue +++ b/src/pages/logout.vue @@ -20,7 +20,7 @@ export default { async mounted() { window.open(LIKECOIN_LOGOUT_POPUP_URL); await this.userLogout(); - this.$router.replace(this.getHomeRoute); + this.$router.replace(this.localeLocation(this.getHomeRoute)); }, methods: { ...mapActions(['userLogout']), diff --git a/src/pages/nft/class/_classId/_nftId.vue b/src/pages/nft/class/_classId/_nftId.vue index 4e442629d..392eba480 100644 --- a/src/pages/nft/class/_classId/_nftId.vue +++ b/src/pages/nft/class/_classId/_nftId.vue @@ -550,10 +550,12 @@ export default { onSelectNFT(e) { const { value: nftId } = e.target; logTrackerEvent(this, 'NFT', 'nft_details_select_nft', nftId, 1); - this.$router.push({ - name: 'nft-class-classId-nftId', - params: { classId: this.classId, nftId }, - }); + this.$router.push( + this.localeLocation({ + name: 'nft-class-classId-nftId', + params: { classId: this.classId, nftId }, + }) + ); }, onToggleTransfer() { this.isOpenTransferModal = true; @@ -644,10 +646,12 @@ export default { this.nftId, 1 ); - this.$router.push({ - name: 'nft-class-classId-nftId', - params: { classId: this.classId, nftId: this.nftIdCollectNext }, - }); + this.$router.push( + this.localeLocation({ + name: 'nft-class-classId-nftId', + params: { classId: this.classId, nftId: this.nftIdCollectNext }, + }) + ); }, handleClickUserCollectedCount() { logTrackerEvent( diff --git a/src/pages/nft/class/_classId/index.vue b/src/pages/nft/class/_classId/index.vue index 7012124f7..24072b88e 100644 --- a/src/pages/nft/class/_classId/index.vue +++ b/src/pages/nft/class/_classId/index.vue @@ -379,10 +379,12 @@ export default { this.nftId, 1 ); - this.$router.push({ - name: 'nft-class-classId-nftId', - params: { classId: this.classId, nftId: this.nftIdCollectNext }, - }); + this.$router.push( + this.localeLocation({ + name: 'nft-class-classId-nftId', + params: { classId: this.classId, nftId: this.nftIdCollectNext }, + }) + ); }, handleClickSellFromPriceSection() { logTrackerEvent( diff --git a/src/pages/nft/fiat/stripe.vue b/src/pages/nft/fiat/stripe.vue index fa4371927..bc6db3653 100644 --- a/src/pages/nft/fiat/stripe.vue +++ b/src/pages/nft/fiat/stripe.vue @@ -29,12 +29,14 @@ export default { uiIsOpenCollectModal(isOpen) { if (!isOpen) { if (this.classId) { - this.$router.replace({ - name: 'nft-class-classId', - params: { classId: this.classId }, - }); + this.$router.replace( + this.localeLocation({ + name: 'nft-class-classId', + params: { classId: this.classId }, + }) + ); } else { - this.$router.replace('/'); + this.$router.replace(this.localeLocation({ name: 'index' })); } } }, diff --git a/src/pages/oauth/redirect.vue b/src/pages/oauth/redirect.vue index d1517bfaf..eaf68a4c6 100644 --- a/src/pages/oauth/redirect.vue +++ b/src/pages/oauth/redirect.vue @@ -66,7 +66,7 @@ export default { if (postAuthRoute) { this.$router.replace(postAuthRoute); } else { - this.$router.replace(this.getHomeRoute); + this.$router.replace(this.localeLocation(this.getHomeRoute)); } } catch (err) { const errData = err.response || err;