Check that each location's latest photo exists
This commit is contained in:
@@ -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)
|
||||||
location.last_updated = latestPhoto.created_on
|
if (latestPhoto) {
|
||||||
|
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 />
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user