Filter continents with linked countries in server request
This commit is contained in:
@@ -6,10 +6,7 @@
|
|||||||
|
|
||||||
export let locations: any
|
export let locations: any
|
||||||
|
|
||||||
const { continent } = getContext('global')
|
const { continent, settings: { explore_list }} = getContext('global')
|
||||||
|
|
||||||
// Filter continents with linked countries
|
|
||||||
const filteredContinents = continent.filter((cont: any) => cont.countries.length)
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="browse">
|
<div class="browse">
|
||||||
@@ -18,7 +15,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul class="browse__continents" role="navigation">
|
<ul class="browse__continents" role="navigation">
|
||||||
{#each filteredContinents as { name, slug }}
|
{#each continent as { name, slug }}
|
||||||
<li>
|
<li>
|
||||||
<Button tag="button" text={name} class="button--small" />
|
<Button tag="button" text={name} class="button--small" />
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -92,9 +92,15 @@
|
|||||||
|
|
||||||
const { data } = res
|
const { data } = res
|
||||||
|
|
||||||
|
// Filter continents with linked countries
|
||||||
|
const filteredContinents = data.continent.filter((cont: any) => cont.countries.length)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
data,
|
data: {
|
||||||
|
...data,
|
||||||
|
continent: filteredContinents,
|
||||||
|
},
|
||||||
count: {
|
count: {
|
||||||
photos: data.photo_aggregated[0].count.id,
|
photos: data.photo_aggregated[0].count.id,
|
||||||
locations: data.location_aggregated[0].count.id,
|
locations: data.location_aggregated[0].count.id,
|
||||||
|
|||||||
Reference in New Issue
Block a user