🐛 (share) go to account after first sync
This commit is contained in:
@@ -1,7 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="account-list">
|
<div class="account-list">
|
||||||
<div class="account-grid" v-if="accounts.length">
|
<div class="account-grid" v-if="accounts.length">
|
||||||
<account-card v-for="(account, k) in accounts" :key="k" :account="account" />
|
<account-card
|
||||||
|
v-for="(account, k) in accounts"
|
||||||
|
:key="k"
|
||||||
|
:account="account"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="fetched">
|
<div v-else-if="fetched">
|
||||||
<awe-icon icon="inbox" /> Les comptes créés s'afficheront ici.
|
<awe-icon icon="inbox" /> Les comptes créés s'afficheront ici.
|
||||||
@@ -43,6 +47,10 @@ export default class AccountList extends Vue {
|
|||||||
bus.$on(SYNC, this.getData)
|
bus.$on(SYNC, this.getData)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public beforeDestroy() {
|
||||||
|
bus.$off(SYNC, this.getData)
|
||||||
|
}
|
||||||
|
|
||||||
public async getData(): Promise<void> {
|
public async getData(): Promise<void> {
|
||||||
this.accounts = await accountService.getAll(this.archived)
|
this.accounts = await accountService.getAll(this.archived)
|
||||||
this.fetched = true
|
this.fetched = true
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import { Action, Getter } from 'vuex-class'
|
import { Action, Getter } from 'vuex-class'
|
||||||
import { Component, Prop } from 'vue-property-decorator'
|
import { Component, Prop } from 'vue-property-decorator'
|
||||||
|
import bus, { SYNC } from '@/utils/bus-event'
|
||||||
import IUser from '@/models/IUser'
|
import IUser from '@/models/IUser'
|
||||||
import IAccount from '@/models/IAccount'
|
import IAccount from '@/models/IAccount'
|
||||||
import queueNotifService from '@/services/QueueNotifService'
|
import queueNotifService from '@/services/QueueNotifService'
|
||||||
@@ -22,6 +23,7 @@ export default class AccountPublic extends Vue {
|
|||||||
public addAccountId!: any
|
public addAccountId!: any
|
||||||
|
|
||||||
public async mounted(): Promise<void> {
|
public async mounted(): Promise<void> {
|
||||||
|
bus.$on(SYNC, this.goToAccount)
|
||||||
try {
|
try {
|
||||||
if (this.id) {
|
if (this.id) {
|
||||||
this.account = await accountService.get(this.id)
|
this.account = await accountService.get(this.id)
|
||||||
@@ -32,21 +34,28 @@ export default class AccountPublic extends Vue {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.account = await accountService.getRemote(this.id)
|
this.account = await accountService.getRemote(this.id)
|
||||||
|
|
||||||
if (this.account && this.account.isPublic) {
|
if (this.account && this.account.isPublic) {
|
||||||
this.addAccountId({ accountId: this.id })
|
this.addAccountId({ accountId: this.id })
|
||||||
|
await couchService.initLive()
|
||||||
queueNotifService.success(
|
queueNotifService.success(
|
||||||
`Récupération du compte public ${this.account.name} en cours...`
|
`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
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public beforeDestroy() {
|
||||||
|
bus.$off(SYNC, this.goToAccount)
|
||||||
|
}
|
||||||
|
|
||||||
|
public goToAccount() {
|
||||||
|
this.$router.push({
|
||||||
|
name: 'account',
|
||||||
|
params: { id: this.id }
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user