filter outside of component
This commit is contained in:
		
							parent
							
								
									8af8f719e4
								
							
						
					
					
						commit
						da08388d6a
					
				
					 2 changed files with 17 additions and 3 deletions
				
			
		|  | @ -265,7 +265,10 @@ const Status = { | |||
|     }, | ||||
|     combinedFavsAndRepeatsAvatars () { | ||||
|       // Use the status from the global status repository since favs and repeats are saved in it
 | ||||
|       const combinedAvatars = [].concat(this.statusFromGlobalRepository.favoritedBy, this.statusFromGlobalRepository.rebloggedBy).filter(_ => _) | ||||
|       const combinedAvatars = [].concat( | ||||
|         this.statusFromGlobalRepository.favoritedBy, | ||||
|         this.statusFromGlobalRepository.rebloggedBy | ||||
|       ) | ||||
|       return uniqBy(combinedAvatars, 'id') | ||||
|     } | ||||
|   }, | ||||
|  |  | |||
|  | @ -533,8 +533,19 @@ const statuses = { | |||
|       }) | ||||
|     }, | ||||
|     fetchFavsAndRepeats ({ rootState, commit }, id) { | ||||
|       Promise.all([rootState.api.backendInteractor.fetchFavoritedByUsers(id), rootState.api.backendInteractor.fetchRebloggedByUsers(id)]) | ||||
|         .then(([favoritedByUsers, rebloggedByUsers]) => commit('addFavsAndRepeats', { id, favoritedByUsers, rebloggedByUsers })) | ||||
|       Promise.all([ | ||||
|         rootState.api.backendInteractor.fetchFavoritedByUsers(id), | ||||
|         rootState.api.backendInteractor.fetchRebloggedByUsers(id) | ||||
|       ]).then(([favoritedByUsers, rebloggedByUsers]) => | ||||
|         commit( | ||||
|           'addFavsAndRepeats', | ||||
|           { | ||||
|             id, | ||||
|             favoritedByUsers: favoritedByUsers.filter(_ => _), | ||||
|             rebloggedByUsers: rebloggedByUsers.filter(_ => _) | ||||
|           } | ||||
|         ) | ||||
|       ) | ||||
|     } | ||||
|   }, | ||||
|   mutations | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 shpuld
						shpuld