aboutsummaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
authorHenry Jameson <me@hjkos.com>2019-03-08 00:35:30 +0200
committerHenry Jameson <me@hjkos.com>2019-03-08 00:35:30 +0200
commitee49409049430dedf042ddbeb73898f605664cd2 (patch)
tree0d75e17b13d3906a5f97bc4025bf0a6e4a53c649 /src/components
parent09736691ea79e66c9e41d6f723384769088eb2d0 (diff)
Partially transitioned user data to MastoAPI. Added support for fetching
relationship data. Upgraded code to be more resilient to nulls caused by missing data in either APIs
Diffstat (limited to 'src/components')
-rw-r--r--src/components/user_card/user_card.js3
-rw-r--r--src/components/user_profile/user_profile.js3
2 files changed, 6 insertions, 0 deletions
diff --git a/src/components/user_card/user_card.js b/src/components/user_card/user_card.js
index 80d15a27..43a77f45 100644
--- a/src/components/user_card/user_card.js
+++ b/src/components/user_card/user_card.js
@@ -15,6 +15,9 @@ export default {
betterShadow: this.$store.state.interface.browserSupport.cssFilter
}
},
+ created () {
+ this.$store.dispatch('fetchUserRelationship', this.user.id)
+ },
computed: {
classes () {
return [{
diff --git a/src/components/user_profile/user_profile.js b/src/components/user_profile/user_profile.js
index 54126514..345e7035 100644
--- a/src/components/user_profile/user_profile.js
+++ b/src/components/user_profile/user_profile.js
@@ -43,6 +43,7 @@ const UserProfile = {
this.startFetchFavorites()
if (!this.user.id) {
this.$store.dispatch('fetchUser', this.fetchBy)
+ .then(() => this.$store.dispatch('fetchUserRelationship', this.fetchBy))
.catch((reason) => {
const errorMessage = get(reason, 'error.error')
if (errorMessage === 'No user with such user_id') { // Known error
@@ -53,6 +54,8 @@ const UserProfile = {
this.error = this.$t('user_profile.profile_loading_error')
}
})
+ } else if (typeof this.user.following === 'undefined' || this.user.following === null) {
+ this.$store.dispatch('fetchUserRelationship', this.fetchBy)
}
},
destroyed () {