<script lang="ts">
    import { setContext } from 'svelte'
    // Other
    import '$utils/polyfills'
    import '../style/style.scss'

    export let data: any

    // Set global data
    setContext('global', data)

    // console.log(data)
</script>

<slot />

<script context="module" lang="ts">
    import { fetchAPI } from '$utils/api'

    export async function load ({ page, session, fetch, context }) {
        const res = await fetchAPI(`
            query {
                location {
                    name
                    slug
                    country {
                        id
                    }
                }

                country {
                    name
                    slug
                }

                continent {
                    name
                    slug
                }

                settings {
                    seo_name
                    seo_title
                    seo_description
                }
            }
        `)

        const { data } = res

        return {
            props: {
                data,
            }
        }
    }
</script>