From d9c02671c29dd675f1ae056ebc8c293203674f8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fe=CC=81lix=20Pe=CC=81ault?= Date: Mon, 27 Sep 2021 23:17:49 +0200 Subject: [PATCH] Get counts from API --- src/routes/__layout.svelte | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/routes/__layout.svelte b/src/routes/__layout.svelte index eb777f4..84c7f10 100644 --- a/src/routes/__layout.svelte +++ b/src/routes/__layout.svelte @@ -6,11 +6,13 @@ import Footer from '$components/organisms/Footer.svelte' export let data: any + export let count: any // Set global data - setContext('global', data) - - // console.log(data) + setContext('global', { + ...data, + count, + }) @@ -56,6 +58,17 @@ instagram footer_links } + + # Count + photo_aggregated { + count { id } + } + location_aggregated { + count { id } + } + country_aggregated { + count { id } + } } `) @@ -64,6 +77,11 @@ return { props: { data, + count: { + photos: data.photo_aggregated[0].count.id, + locations: data.location_aggregated[0].count.id, + countries: data.country_aggregated[0].count.id, + }, } } }