feat: categories count dashboard

This commit is contained in:
Florian Sylvain
2024-10-13 22:51:00 +02:00
parent 57d431a0ba
commit 6758e0e9ea
2 changed files with 33 additions and 1 deletions
+18 -1
View File
@@ -1,5 +1,22 @@
<script setup lang="ts"></script>
<script setup lang="ts">
import NumberDisplay from '@/components/NumberDisplay.vue'
import { useCategoriesStore } from '@/stores/categories'
import { onMounted, ref } from 'vue'
const categoriesStore = useCategoriesStore()
const totalCategories = ref(undefined as number | undefined)
onMounted(async () => {
const fetchedCategories = await categoriesStore.getCategories()
const response = await fetchedCategories.json()
totalCategories.value = response.total
})
</script>
<template>
<h1 class="text-h3">Dashboard</h1>
<section class="d-flex align-center">
<NumberDisplay label="Categories" :data="totalCategories" />
</section>
</template>