Use total photos count from global data

This commit is contained in:
2021-10-24 22:20:01 +02:00
parent 30b8db1385
commit e830a18454

View File

@@ -279,14 +279,13 @@
`) `)
const { data } = res const { data } = res
const locationId = data.location[0].id const photosCount = stuff.countTotalPhotosByLocation.find((total: any) => total.group.location === Number(data.location[0].id))
const locationPhotosCount = data.total_published.find(({ group }: any) => group.location === Number(locationId))
return { return {
props: { props: {
location: data.location[0], location: data.location[0],
photos: data.photos, photos: data.photos,
totalPhotos: data.photos.length ? locationPhotosCount.count.id : 0, totalPhotos: data.photos.length ? photosCount.count.id : 0,
lastUpdated: data.photos.length ? data.photos[0].date_created : undefined, lastUpdated: data.photos.length ? data.photos[0].date_created : undefined,
} }
} }