This commit is contained in:
@@ -44,6 +44,8 @@
|
|||||||
country { id }
|
country { id }
|
||||||
description
|
description
|
||||||
coordinates
|
coordinates
|
||||||
|
illustration_desktop { full_url }
|
||||||
|
illustration_mobile { full_url }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}`})
|
}`})
|
||||||
|
|||||||
@@ -4,25 +4,8 @@
|
|||||||
// Preload data
|
// Preload data
|
||||||
export async function preload (page, session) {
|
export async function preload (page, session) {
|
||||||
// Load photos
|
// 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 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 req = await this.fetch(apiEndpoints.gql, {
|
|
||||||
method: 'post',
|
|
||||||
headers: { 'Content-Type': 'application/json' },
|
|
||||||
body: JSON.stringify({ query: `{
|
|
||||||
photos (filter: { slug_has: "${page.params.place}" }, limit: -1) {
|
|
||||||
data {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
slug
|
|
||||||
date
|
|
||||||
created_on
|
|
||||||
modified_on
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}`})
|
|
||||||
})
|
|
||||||
const photos = await req.json()
|
const photos = await req.json()
|
||||||
console.log(photos)
|
|
||||||
if (req.ok) {
|
if (req.ok) {
|
||||||
return { photos: photos.data }
|
return { photos: photos.data }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user