diff --git a/src/molecules/InteractiveGlobe.svelte b/src/molecules/InteractiveGlobe.svelte
index 6c5c824..3a0f1d5 100644
--- a/src/molecules/InteractiveGlobe.svelte
+++ b/src/molecules/InteractiveGlobe.svelte
@@ -69,13 +69,13 @@
{#if type !== 'part'}
- {#each $locations as location}
-
+ {#if $site.credits_list}
- {#each $site.credits_list as category}
+ {#each $site.credits_list as { title, credits }}
-
{category.name}
- {#each category.credits as person}
+
{title}
+ {#each credits as { name, role, website }, i}
-
- {#if person.url}
-
+ {#if website}
+
{:else}
- {person.name}
+ {name}
{/if}
- - {person.role}
+ - {role}
{/each}
{/each}
+ {/if}
diff --git a/src/routes/index.svelte b/src/routes/index.svelte
index 2ade781..067f915 100644
--- a/src/routes/index.svelte
+++ b/src/routes/index.svelte
@@ -4,13 +4,18 @@
// Preload data
export async function preload (page, session) {
// Load random photos
+ const fields = [
+ 'id', 'name', 'image.private_hash',
+ 'location.id', 'location.name', 'location.slug', 'location.country.name'
+ ]
+ const sort = '?'
const limit = 5
- const req = await this.fetch(`${apiEndpoints.rest}/items/photos?fields=id,name,image.*,location.*,location.country.name&sort=?&limit=${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) {
return { photos: photos.data }
}
- this.error(404, 'Not found')
+ this.error(404, 'Not found')
}
diff --git a/src/routes/location/[country]/[place].svelte b/src/routes/location/[country]/[place].svelte
index cacc45b..fd5a2af 100644
--- a/src/routes/location/[country]/[place].svelte
+++ b/src/routes/location/[country]/[place].svelte
@@ -4,7 +4,14 @@
// Preload data
export async function preload (page, session) {
// Load photos
- const req = await this.fetch(`${apiEndpoints.rest}/items/photos?fields=id,name,slug,date,image.*,location.*,location.country.*,created_on,modified_on&filter[location.slug][rlike]=%${page.params.place}%&limit=-1&sort=-created_on,name`)
+ const fields = [
+ 'id', 'name', 'slug', 'date', 'image.*',
+ 'location.id', 'location.name', 'location.region', 'location.country.name',
+ 'created_on', 'modified_on'
+ ]
+ const sort = ['-created_on', 'name']
+ const limit = -1
+ const req = await this.fetch(`${apiEndpoints.rest}/items/photos?fields=${fields.join()}&filter[location.slug][rlike]=%${page.params.place}%&limit=${limit}&sort=${sort.join()}`)
const photos = await req.json()
if (req.ok) {
return { photos: photos.data }
diff --git a/src/utils/store.js b/src/utils/store.js
index 19123c5..909725f 100644
--- a/src/utils/store.js
+++ b/src/utils/store.js
@@ -9,8 +9,9 @@ export const dev = process.env.NODE_ENV === 'development'
Site related
========================================================================== */
const apiEndpoint = dev ? 'http://api.housesof.localhost/how' : 'https://api.housesof.world/_'
+const apiAccessToken = 'NJk0urljsdSvApUDzWxGgoO6'
export const apiEndpoints = {
- gql: apiEndpoint + '/gql?access_token=NJk0urljsdSvApUDzWxGgoO6',
+ gql: `${apiEndpoint}/gql?access_token=${apiAccessToken}`,
rest: apiEndpoint
}