<template>
  <template v-if="data">
    <Tabs :projects="data.children" @update:currentTab="changeTab" />
    <TabPanel :projects="data.children" :currentTab="currentTab" />
  </template>
</template>
<script setup>
import Tabs from "./Tabs.vue";
import TabPanel from "./TabPanel.vue";
import { useApiStore } from "../stores/api";
import { ref } from "vue";

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;
}
</script>

<style scoped></style>
