Fix photos list and add currentPhotos store
Go from one object to two to avoid issues when using an object key
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<script context="module">
|
||||
// Svelte
|
||||
import { apiEndpoints, site, locations, currentLocation } from '../../../store'
|
||||
import { apiEndpoints, site, locations, currentLocation, currentPhotos } from '../../../store'
|
||||
import { stores } from '@sapper/app'
|
||||
|
||||
// Preload data
|
||||
@@ -43,7 +43,8 @@
|
||||
|
||||
// Update current location
|
||||
const location = $locations.find(loc => loc.slug === $page.params.location)
|
||||
currentLocation.set({ location, photos })
|
||||
currentLocation.set(location)
|
||||
currentPhotos.set(photos)
|
||||
|
||||
// Define dates
|
||||
const dateUpdatedFull = photos.length ? dayjs(photos[0].modified_on).format('MMM Do, YYYY') : ''
|
||||
@@ -157,7 +158,11 @@
|
||||
|
||||
<div class="photos__view wrap">
|
||||
{#each paginatedPhotos as photo, index}
|
||||
<Photo {photo} index={index + 1} />
|
||||
<Photo
|
||||
photo={photo}
|
||||
layout={layoutSetting}
|
||||
index={photos.length - (photos.indexOf(photo))}
|
||||
/>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user