Skip to content

Commit

Permalink
Fix bugs, when user has no blacklist
Browse files Browse the repository at this point in the history
  • Loading branch information
roschaefer committed Aug 23, 2018
1 parent dc7f59c commit b27da6b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion components/mixins/blacklistable.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ export default {
blacklistPending: 'feathers-vuex-usersettings/isPending'
}),
isBlacklisted () {
return this.currentUserSettings.blacklist.includes(this.author()._id)
let { blacklist } = this.currentUserSettings
return blacklist && blacklist.includes(this.author()._id)
}
},
methods: {
Expand Down
5 changes: 3 additions & 2 deletions pages/auth/settings/blacklist.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ import Author from '~/components/Author/Author.vue'
}
},
async asyncData ({store}) {
const currentUserSettings = store.getters['feathers-vuex-usersettings/current'];
const res = await store.dispatch('feathers-vuex-users/find', { query: {_id: { $in: currentUserSettings.blacklist } } } );
const { blacklist } = store.getters['feathers-vuex-usersettings/current'];
if (!blacklist) return {}
const res = await store.dispatch('feathers-vuex-users/find', { query: {_id: { $in: blacklist } } } );
return {
blacklistedUsers: res.data
}
Expand Down

0 comments on commit b27da6b

Please sign in to comment.