🐛 (share) go to account after first sync
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
import Vue from 'vue'
|
||||
import { Action, Getter } from 'vuex-class'
|
||||
import { Component, Prop } from 'vue-property-decorator'
|
||||
import bus, { SYNC } from '@/utils/bus-event'
|
||||
import IUser from '@/models/IUser'
|
||||
import IAccount from '@/models/IAccount'
|
||||
import queueNotifService from '@/services/QueueNotifService'
|
||||
@@ -22,6 +23,7 @@ export default class AccountPublic extends Vue {
|
||||
public addAccountId!: any
|
||||
|
||||
public async mounted(): Promise<void> {
|
||||
bus.$on(SYNC, this.goToAccount)
|
||||
try {
|
||||
if (this.id) {
|
||||
this.account = await accountService.get(this.id)
|
||||
@@ -32,21 +34,28 @@ export default class AccountPublic extends Vue {
|
||||
}
|
||||
} catch (error) {
|
||||
this.account = await accountService.getRemote(this.id)
|
||||
|
||||
if (this.account && this.account.isPublic) {
|
||||
this.addAccountId({ accountId: this.id })
|
||||
await couchService.initLive()
|
||||
queueNotifService.success(
|
||||
`Récupération du compte public ${this.account.name} en cours...`
|
||||
)
|
||||
|
||||
await couchService.initLive()
|
||||
this.$router.push({
|
||||
name: 'account',
|
||||
params: { id: this.id }
|
||||
})
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
public beforeDestroy() {
|
||||
bus.$off(SYNC, this.goToAccount)
|
||||
}
|
||||
|
||||
public goToAccount() {
|
||||
this.$router.push({
|
||||
name: 'account',
|
||||
params: { id: this.id }
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user