Files
housesof/src/routes/_layout.svelte

60 lines
1.2 KiB
Svelte

<script context="module">
import { api, site, countries, locations, currentLocation } from '../store'
export async function preload (page, segment) {
const res = await this.fetch(api.graphql, {
method: 'post',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ query: `{
site {
data {
description
explore_globe
explore_list
instagram
}
}
countries {
data {
name
slug
flag { metadata }
}
}
locations (filter: { status_eq: "published" }) {
data {
name
slug
region
country { name slug }
description
}
}
}`})
})
const data = await res.json()
// Set data into store
countries.set(data.data.countries.data)
locations.set(data.data.locations.data)
site.set(data.data.site.data[0])
}
</script>
<script>
// Dependencies
import '../../node_modules/bulma/css/bulma.min.css'
import '../../node_modules/@fortawesome/fontawesome-free/css/all.min.css'
// Components
import Footer from '../parts/Footer.svelte'
</script>
<svelte:head>
<title>Houses Of - Beautiful houses of planet Earth</title>
</svelte:head>
<slot></slot>
<Footer />