Rename global data arrays as plural by default

Easier for each loop and maps as to use singular
This commit is contained in:
2021-10-12 00:05:19 +02:00
parent 1ea9b9fadf
commit cd2b234728
7 changed files with 25 additions and 35 deletions

View File

@@ -28,16 +28,14 @@
export async function load ({ page, session, fetch, context }) {
const res = await fetchAPI(`
query {
location (filter: { status: { _eq: "published" }}) {
locations: location (filter: { status: { _eq: "published" }}) {
name
slug
coordinates
country {
name
slug
flag {
id
}
flag { id }
}
date_updated
photos (sort: "-date_created", limit: ${import.meta.env.VITE_PREVIEW_COUNT}) {
@@ -49,24 +47,18 @@
has_poster
}
country (filter: { status: { _eq: "published" }}) {
countries: country (filter: { status: { _eq: "published" }}) {
name
slug
flag {
id
}
locations {
slug
}
flag { id }
locations { id slug }
}
continent {
continents: continent {
name
slug
rotation
countries {
slug
}
countries { id slug }
}
settings {
@@ -86,7 +78,10 @@
shop {
module_title
module_text
module_image { id title }
module_image {
id
title
}
}
# Count
@@ -111,7 +106,7 @@
props: {
data: {
...data,
continent: filteredContinents,
continents: filteredContinents,
},
count: {
photos: data.photo_aggregated[0].count.id,

View File

@@ -15,7 +15,7 @@
export let photos: any
const { settings, location }: any = getContext('global')
const { settings, locations }: any = getContext('global')
const { path } = $page
</script>
@@ -75,9 +75,7 @@
<InteractiveGlobe />
<p class="homepage__title--world title-huge">World</p>
<Locations
locations={location}
/>
<Locations {locations} />
</section>
<div class="grid-modules">

View File

@@ -10,7 +10,7 @@
export let photos: any
const { location }: any = getContext('global')
const { locations }: any = getContext('global')
</script>
<Metas
@@ -27,10 +27,7 @@
<section class="explore__locations" id="locations">
<InteractiveGlobe />
<Locations
locations={location}
/>
<Locations {locations} />
</section>
<section class="grid-modules grid">

View File

@@ -24,7 +24,7 @@
dayjs.extend(relativeTime)
const { country: countries }: any = getContext('global')
const { countries }: any = getContext('global')
let buttonReset: HTMLElement
let buttonShuffle: HTMLElement