Cleanup GraphQL query and add types
This commit is contained in:
@@ -63,9 +63,10 @@
|
||||
<SVGSprite />
|
||||
|
||||
<script context="module" lang="ts">
|
||||
import type { LoadEvent, LoadOutput } from '@sveltejs/kit'
|
||||
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(`
|
||||
query {
|
||||
locations: location (filter: { status: { _eq: "published" }}) {
|
||||
@@ -80,7 +81,10 @@
|
||||
continent { slug }
|
||||
}
|
||||
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 {
|
||||
id
|
||||
title
|
||||
@@ -132,17 +136,13 @@
|
||||
}
|
||||
|
||||
# Count
|
||||
countPhotos: photo_aggregated (
|
||||
filter: { status: { _eq: "published" }},
|
||||
) {
|
||||
countPhotos: photo_aggregated (filter: { status: { _eq: "published" }}) {
|
||||
count { id }
|
||||
}
|
||||
countLocations: location_aggregated (
|
||||
filter: { status: { _eq: "published" }},
|
||||
) {
|
||||
countLocations: location_aggregated (filter: { status: { _eq: "published" }}) {
|
||||
count { id }
|
||||
}
|
||||
countCountries: country_aggregated {
|
||||
countCountries: country_aggregated (filter: { status: { _eq: "published" }}) {
|
||||
count { id }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user