create projects store

This commit is contained in:
isUnknown 2024-09-10 08:49:09 +02:00
parent 18ac3b9173
commit 893d173c59
6 changed files with 360 additions and 106 deletions

View file

@ -1,22 +1,21 @@
<template>
<h2 id="tabslist" class="sr-only">Projets</h2>
<template v-if="data">
<Tabs :projects="data.children" @update:currentTab="changeTab" />
<TabPanel :projects="data.children" :currentTab="currentTab" />
<template v-if="projects.children">
<Tabs :projects="projects.children" @update:currentTab="changeTab" />
<TabPanel :projects="projects.children" :currentTab="currentTab" />
</template>
</template>
<script setup>
import Tabs from "./Tabs.vue";
import TabPanel from "./TabPanel.vue";
import { useApiStore } from "../stores/api";
import { useProjectsStore } from "../stores/projects";
import { ref } from "vue";
import { storeToRefs } from "pinia";
const { projects } = storeToRefs(useProjectsStore());
const data = ref(null);
const currentTab = ref("current");
const api = useApiStore();
api.fetchPageData("projects").then((res) => (data.value = res));
function changeTab(newValue) {
currentTab.value = newValue;
}