Make GraphQL queries more compact
This commit is contained in:
@@ -6,50 +6,48 @@ import { getProducts } from '$utils/functions/swell'
|
||||
export const load: PageServerLoad = async () => {
|
||||
try {
|
||||
// Get content from API
|
||||
const res = await fetchAPI(`
|
||||
query {
|
||||
shop {
|
||||
page_heroimage { id }
|
||||
}
|
||||
const res = await fetchAPI(`query {
|
||||
shop {
|
||||
page_heroimage { id }
|
||||
}
|
||||
|
||||
location (
|
||||
filter: {
|
||||
has_poster: { _eq: true },
|
||||
status: { _eq: "published" },
|
||||
},
|
||||
sort: "name"
|
||||
) {
|
||||
location (
|
||||
filter: {
|
||||
has_poster: { _eq: true },
|
||||
status: { _eq: "published" },
|
||||
},
|
||||
sort: "name"
|
||||
) {
|
||||
name
|
||||
slug
|
||||
}
|
||||
|
||||
posters: product (
|
||||
filter: { status: { _eq: "published" }}
|
||||
) {
|
||||
name
|
||||
type
|
||||
description
|
||||
details
|
||||
location {
|
||||
name
|
||||
slug
|
||||
}
|
||||
|
||||
posters: product (
|
||||
filter: { status: { _eq: "published" }}
|
||||
) {
|
||||
name
|
||||
type
|
||||
description
|
||||
details
|
||||
location {
|
||||
name
|
||||
slug
|
||||
product_id
|
||||
photos_product {
|
||||
directus_files_id {
|
||||
id
|
||||
title
|
||||
}
|
||||
product_id
|
||||
photos_product {
|
||||
directus_files_id {
|
||||
id
|
||||
title
|
||||
}
|
||||
}
|
||||
photos_preview {
|
||||
directus_files_id {
|
||||
id
|
||||
title
|
||||
}
|
||||
}
|
||||
photos_preview {
|
||||
directus_files_id {
|
||||
id
|
||||
title
|
||||
}
|
||||
}
|
||||
}
|
||||
`)
|
||||
}`)
|
||||
|
||||
const { data: { shop, location, posters }} = res
|
||||
|
||||
|
||||
Reference in New Issue
Block a user