fixed newsfeed data that was not unique

This commit is contained in:
Grzegorz Leoniec 2018-10-28 14:50:29 +01:00
parent 201b02ac1d
commit 508838179d

View File

@ -1,10 +1,11 @@
<template>
<div>
<ds-flex
v-if="Post && Post.length"
:width="{ base: '100%' }"
gutter="base">
<ds-flex-item
v-for="post in Post"
v-for="post in uniq(Post)"
:width="{ base: '100%', xs: '100%', md: '50%', xl: '33%' }"
:key="post.id">
<hc-post-card :post="post" />
@ -19,6 +20,7 @@
<script>
import gql from 'graphql-tag'
import uniqBy from 'lodash/uniqBy'
import HcPostCard from '~/components/PostCard.vue'
import HcLoadMore from '~/components/LoadMore.vue'
@ -44,6 +46,9 @@ export default {
}
},
methods: {
uniq(items, field = 'id') {
return uniqBy(items, field)
},
href(post) {
return this.$router.resolve({
name: 'post-slug',