Cleanup GraphQL query and add types
This commit is contained in:
@@ -63,9 +63,10 @@
|
|||||||
<SVGSprite />
|
<SVGSprite />
|
||||||
|
|
||||||
<script context="module" lang="ts">
|
<script context="module" lang="ts">
|
||||||
|
import type { LoadEvent, LoadOutput } from '@sveltejs/kit'
|
||||||
import { fetchAPI } from '$utils/api'
|
import { fetchAPI } from '$utils/api'
|
||||||
|
|
||||||
export async function load ({ url, params, fetch, session, stuff }) {
|
export async function load ({}: LoadEvent): Promise<LoadOutput> {
|
||||||
const res = await fetchAPI(`
|
const res = await fetchAPI(`
|
||||||
query {
|
query {
|
||||||
locations: location (filter: { status: { _eq: "published" }}) {
|
locations: location (filter: { status: { _eq: "published" }}) {
|
||||||
@@ -80,7 +81,10 @@
|
|||||||
continent { slug }
|
continent { slug }
|
||||||
}
|
}
|
||||||
date_updated
|
date_updated
|
||||||
photos (sort: "-date_created", limit: ${import.meta.env.VITE_PREVIEW_COUNT}) {
|
photos (
|
||||||
|
sort: "-date_created",
|
||||||
|
limit: ${import.meta.env.VITE_PREVIEW_COUNT}
|
||||||
|
) {
|
||||||
image {
|
image {
|
||||||
id
|
id
|
||||||
title
|
title
|
||||||
@@ -132,17 +136,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Count
|
# Count
|
||||||
countPhotos: photo_aggregated (
|
countPhotos: photo_aggregated (filter: { status: { _eq: "published" }}) {
|
||||||
filter: { status: { _eq: "published" }},
|
|
||||||
) {
|
|
||||||
count { id }
|
count { id }
|
||||||
}
|
}
|
||||||
countLocations: location_aggregated (
|
countLocations: location_aggregated (filter: { status: { _eq: "published" }}) {
|
||||||
filter: { status: { _eq: "published" }},
|
|
||||||
) {
|
|
||||||
count { id }
|
count { id }
|
||||||
}
|
}
|
||||||
countCountries: country_aggregated {
|
countCountries: country_aggregated (filter: { status: { _eq: "published" }}) {
|
||||||
count { id }
|
count { id }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user