improve code quality

This commit is contained in:
Brenden Bice 2019-04-02 11:04:39 -04:00
parent d19bee0b66
commit 4ab2ddb03c
3 changed files with 8 additions and 20 deletions

View file

@ -1,7 +1,7 @@
<template> <template>
<ul class="avatars" :class="{ 'transparent-avatar': slicedAvatars.length == 10 }"> <ul class="avatars" :class="{ 'transparent-avatar': slicedAvatars.length == 10 }">
<li class="avatars__item" v-for="(avatar, index) in slicedAvatars" :key="index"> <li class="avatars__item" v-for="avatar in slicedAvatars" :key="avatar.id">
<UserAvatar :src="avatar.src" class="avatars__img" /> <UserAvatar :src="avatar.avatar_static" class="avatars__img" />
</li> </li>
</ul> </ul>
</template> </template>

View file

@ -153,22 +153,10 @@ const conversation = {
} }
}, },
fetchFavouritedByUsers (id) { fetchFavouritedByUsers (id) {
this.$store.state.api.backendInteractor.fetchFavouritedByUsers({id}).then((response) => { this.$store.dispatch('fetchFavouritedByUsers', { id })
const favoritedByUsers = response.map(item => ({
src: item.avatar_static,
name: item.display_name
}))
this.$store.dispatch('addFavoritedByUsers', { favoritedByUsers, id })
})
}, },
fetchRebloggedByUsers (id) { fetchRebloggedByUsers (id) {
this.$store.state.api.backendInteractor.fetchRebloggedByUsers({id}).then((response) => { this.$store.dispatch('fetchRebloggedByUsers', { id })
const rebloggedByUsers = response.map(item => ({
src: item.avatar_static,
name: item.display_name
}))
this.$store.dispatch('addRebloggedByUsers', { rebloggedByUsers, id })
})
} }
} }
} }

View file

@ -537,11 +537,11 @@ const statuses = {
credentials: rootState.users.currentUser.credentials credentials: rootState.users.currentUser.credentials
}) })
}, },
addFavoritedByUsers ({ rootState, commit }, { favoritedByUsers, id }) { fetchFavouritedByUsers ({ rootState, commit }, { id }) {
commit('addFavoritedByUsers', { favoritedByUsers, id }) rootState.api.backendInteractor.fetchFavouritedByUsers({id}).then((favoritedByUsers) => commit('addFavoritedByUsers', { favoritedByUsers, id }))
}, },
addRebloggedByUsers ({ rootState, commit }, { rebloggedByUsers, id }) { fetchRebloggedByUsers ({ rootState, commit }, { id }) {
commit('addRebloggedByUsers', { rebloggedByUsers, id }) rootState.api.backendInteractor.fetchRebloggedByUsers({id}).then((rebloggedByUsers) => commit('addRebloggedByUsers', { rebloggedByUsers, id }))
} }
}, },
mutations mutations