<template>
    <!-- TODO add "Toiles" et "Impressions" -->
    <main>
        <p>{{ globalData.magasin_explication }}</p>
        <Projects :contents="magasin" />
    </main>
</template>

<script>
import Projects from '@/components/Projects.vue';

export default {
    async setup() {
        const magasin = ref([]);

        const { data: itemsData } = useFetch('/api/items/magasin', { server: true });

        onBeforeMount(async () => {
            if (itemsData.value) {
                magasin.value = itemsData.value.data;
            }
        });

        let globalData = await useFetchGlobalData();
        globalData = globalData.globalData._object.$sglobalData;

        return {
            globalData,
            magasin
        };
    },
    components: {
        Projects
    }
};
</script>