Fix: not updating on user prop change, translation keys

This commit is contained in:
Raphael Beer 2020-03-19 06:28:43 +01:00
parent 984f69a738
commit 37ed748b29
No known key found for this signature in database
GPG Key ID: C1AC5E018B25EF11

View File

@ -2,7 +2,7 @@
<base-card style="position: relative; height: auto;"> <base-card style="position: relative; height: auto;">
<ds-space v-if="this.connections && this.connections.length" margin="x-small"> <ds-space v-if="this.connections && this.connections.length" margin="x-small">
<ds-text tag="h5" color="soft"> <ds-text tag="h5" color="soft">
{{ userName | truncate(15) }} {{ $t('profile.network.following') }} {{ userName | truncate(15) }} {{ $t(`profile.network.${type}`) }}
</ds-text> </ds-text>
</ds-space> </ds-space>
<template v-if="this.connections && this.connections.length"> <template v-if="this.connections && this.connections.length">
@ -24,7 +24,7 @@
</template> </template>
<template v-else> <template v-else>
<p style="text-align: center; opacity: .5;"> <p style="text-align: center; opacity: .5;">
{{ userName }} {{ $t('profile.network.followingNobody') }} {{ userName }} {{ $t(`profile.network.${type}Nobody`) }}
</p> </p>
</template> </template>
</base-card> </base-card>
@ -46,8 +46,7 @@ export default {
}, },
data() { data() {
return { return {
connections: this.user[this.type], additionalConnections: [],
allConnectionsCount: this.user[`${this.type}Count`],
queries: { queries: {
followedBy: followedByQuery, followedBy: followedByQuery,
following: followingQuery, following: followingQuery,
@ -59,6 +58,12 @@ export default {
const { name } = this.user || {} const { name } = this.user || {}
return name || this.$t('profile.userAnonym') return name || this.$t('profile.userAnonym')
}, },
connections() {
return [...this.user[this.type], ...this.additionalConnections]
},
allConnectionsCount() {
return this.user[`${this.type}Count`]
},
}, },
methods: { methods: {
uniq(items, field = 'id') { uniq(items, field = 'id') {
@ -70,8 +75,7 @@ export default {
variables: { id: this.user.id }, variables: { id: this.user.id },
// neither result nor update are being called when defined here (?) // neither result nor update are being called when defined here (?)
}) })
const connections = data.User[0][this.type] this.additionalConnections = data.User[0][this.type]
this.connections = this.connections.concat(connections)
}, },
}, },
} }