117117import { Component , Vue , Watch } from ' nuxt-property-decorator'
118118import { notificationTypes , showNotification } from ' @/utils/notification'
119119import { sanitizeIpfsUrl , fetchNFTMetadata } from ' @/components/rmrk/utils'
120- import { exist } from ' @/components/rmrk/Gallery/Search/exist'
121120import { CollectionWithMeta , Pack } from ' @/components/rmrk/service/scheme'
122121import isShareMode from ' @/utils/isShareMode'
123122import shouldUpdate from ' @/utils/shouldUpdate'
@@ -193,7 +192,6 @@ const eq = (tab: string) => (el: string) => tab === el
193192 }
194193})
195194export default class Profile extends Vue {
196- public activeTab = ' nft' ;
197195 public firstNFTData: any = {};
198196 protected id = ' ' ;
199197 protected shortendId = ' ' ;
@@ -223,9 +221,6 @@ export default class Profile extends Vue {
223221
224222 public async mounted() {
225223 await this .fetchProfile ()
226- exist (this .$route .query .tab , (val ) => {
227- this .activeTab = val
228- })
229224 }
230225
231226 public checkId() {
@@ -235,6 +230,17 @@ export default class Profile extends Vue {
235230 }
236231 }
237232
233+ get activeTab(): string {
234+ return this .$route .query .tab as string || ' nft'
235+ }
236+
237+ set activeTab(val ) {
238+ this .$route .query .page = ' '
239+ this .$router .replace ({
240+ query: { tab: val },
241+ })
242+ }
243+
238244 get sharingVisible(): boolean {
239245 return isShareMode
240246 }
@@ -264,7 +270,6 @@ export default class Profile extends Vue {
264270
265271 protected async fetchProfile() {
266272 this .checkId ()
267- this .checkActiveTab ()
268273
269274 try {
270275 this .$apollo .addSmartQuery (' collections' , {
@@ -336,25 +341,6 @@ export default class Profile extends Vue {
336341 this .legal = identityFields ?.legal as string
337342 }
338343
339- public checkActiveTab() {
340- if (
341- this .$route .params .tab &&
342- [' nft' , ' collection' , ' pack' ].some (eq (this .$route .params .tab ))
343- ) {
344- this .activeTab = this .$route .params .tab
345- }
346- }
347-
348- @Watch (' activeTab' )
349- protected onTabChange(val : string , oldVal : string ) {
350- if (shouldUpdate (val , oldVal )) {
351- this .$router .replace ({
352- path: String (this .$route .path ),
353- query: { tab: val },
354- })
355- }
356- }
357-
358344 @Watch (' $route.params.id' )
359345 protected onIdChange(val : string , oldVal : string ) {
360346 if (shouldUpdate (val , oldVal )) {
0 commit comments