Code clean,

This commit is contained in:
2020-04-06 12:21:47 +02:00
parent 60fdf02112
commit 8fabe68241
7 changed files with 55 additions and 60 deletions

View File

@@ -1,6 +1,6 @@
<script context="module">
// Variables
let limit
let limit = process.env.CONFIG.HOME_PHOTOS_LIMIT
// Preload data (photos to display)
export async function preload (page, session) {
@@ -11,12 +11,9 @@
]
// Random sort
const sort = '?'
// Get the limit from API
site.subscribe(store => limit = store.homepage_photos_limit)
const req = await this.fetch(`${apiEndpoints.rest}/items/photos?fields=${fields.join()}&sort=${sort}&limit=${limit}`)
const photos = await req.json()
if (req.ok) {
if (req.ok) {
return { photos: photos.data }
}
this.error(404, 'Not found')
@@ -103,10 +100,8 @@
</div>
<div id="intro-carousel">
{#if photos}
<Carousel {photos} />
<Fullscreen />
{/if}
</div>
</section>