Check that each location's latest photo exists

This commit is contained in:
2020-06-01 22:19:35 +02:00
parent c82c818592
commit 94859c3543

View File

@@ -99,7 +99,9 @@
// Add last updated date to each location // Add last updated date to each location
data.locations.data.forEach(location => { data.locations.data.forEach(location => {
const latestPhoto = latestPhotos.find(photo => photo.location.id === location.id) const latestPhoto = latestPhotos.find(photo => photo.location.id === location.id)
if (latestPhoto) {
location.last_updated = latestPhoto.created_on location.last_updated = latestPhoto.created_on
}
}) })
// Set data into store // Set data into store
@@ -171,7 +173,7 @@
{/each} {/each}
</svelte:head> </svelte:head>
<slot></slot> <slot />
<Transition /> <Transition />