diff --git a/src/components/user_card/user_card.js b/src/components/user_card/user_card.js index d7fe71d0..e019ebbd 100644 --- a/src/components/user_card/user_card.js +++ b/src/components/user_card/user_card.js @@ -138,10 +138,10 @@ export default { this.$store.dispatch('unmuteUser', this.user.id) }, subscribeUser () { - return this.$store.state.api.backendInteractor.subscribeUser(this.user.id) + return this.$store.dispatch('subscribeUser', this.user.id) }, unsubscribeUser () { - return this.$store.state.api.backendInteractor.unsubscribeUser(this.user.id) + return this.$store.dispatch('unsubscribeUser', this.user.id) }, setProfileView (v) { if (this.switcher) { diff --git a/src/modules/users.js b/src/modules/users.js index f9b609b4..c7ebbc85 100644 --- a/src/modules/users.js +++ b/src/modules/users.js @@ -305,6 +305,14 @@ const users = { clearFollowers ({ commit }, userId) { commit('clearFollowers', userId) }, + subscribeUser ({ rootState, commit }, id) { + return rootState.api.backendInteractor.subscribeUser(id) + .then((relationship) => commit('updateUserRelationship', [relationship])) + }, + unsubscribeUser ({ rootState, commit }, id) { + return rootState.api.backendInteractor.unsubscribeUser(id) + .then((relationship) => commit('updateUserRelationship', [relationship])) + }, registerPushNotifications (store) { const token = store.state.currentUser.credentials const vapidPublicKey = store.rootState.instance.vapidPublicKey