feat: themes controller

This commit is contained in:
Gabriellvl 2025-03-21 18:29:35 +01:00
parent b4fceeb958
commit d71f2deb89
4 changed files with 37 additions and 2 deletions

View file

@ -3,6 +3,7 @@
import { ref, onMounted, watch } from "vue";
import { useI18n } from "vue-i18n";
import {AGE_TO_THEMES, THEMESITEMS} from "@/utils/constants.ts";
import {getAllThemes} from "@/controller/themes.ts";
// Receive the selectedTheme and selectedAge from the parent component
const props = defineProps({
@ -26,10 +27,9 @@
try {
// Get the current selected language
const language = locale.value;
const response = await fetch(`http://localhost:3000/api/theme?language=${language}`);
// Update the cards value with the fetched themes
allCards.value = await response.json();
allCards.value = await getAllThemes(language);
cards.value = allCards.value;
} catch (error) {
console.error("Error fetching themes:", error);