diff --git a/bun.lockb b/bun.lockb index 1451fc3..7b9029a 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/components/recipe/card.vue b/components/recipe/card.vue new file mode 100644 index 0000000..1db9cbf --- /dev/null +++ b/components/recipe/card.vue @@ -0,0 +1,29 @@ + + + diff --git a/composables/useRecipe.ts b/composables/useRecipe.ts new file mode 100644 index 0000000..69ecbc2 --- /dev/null +++ b/composables/useRecipe.ts @@ -0,0 +1,28 @@ +type Recipe = { + title: string; + pictureUrl: string; + videoUrl: string; + category: string; + origin: string; +}; + +export default async function () { + const { data, error } = await useAsyncData("random", () => { + const config = useRuntimeConfig(); + return $fetch(`${config.apiUrl}random.php`); + }); + + const tmp = data.value?.meals?.[0]; + const recipe = reactive({ + title: tmp?.strMeal, + pictureUrl: tmp?.strMealThumb, + videoUrl: tmp?.strYoutube, + category: tmp?.strCategory, + origin: tmp?.strArea, + }); + + return { + recipe, + error, + }; +} diff --git a/nuxt.config.ts b/nuxt.config.ts index 06f85e7..445218e 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -2,7 +2,7 @@ export default defineNuxtConfig({ devtools: { enabled: true }, css: ["~/assets/css/main.css"], - modules: ["@nuxt/eslint", "@nuxt/image"], + modules: ["@nuxt/eslint", "@nuxt/image", "nuxt-icon"], postcss: { plugins: { tailwindcss: {}, @@ -16,4 +16,4 @@ export default defineNuxtConfig({ public: {}, }, ssr: true, -}); +}); \ No newline at end of file diff --git a/package.json b/package.json index 3cc9f2e..642ac83 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "@nuxt/eslint": "^0.3.10", "@nuxt/image": "^1.6.0", "nuxt": "^3.11.2", + "nuxt-icon": "^0.6.10", "vue": "^3.4.21", "vue-router": "^4.3.0" }, diff --git a/pages/random.vue b/pages/random.vue index bc3ae92..75b676a 100644 --- a/pages/random.vue +++ b/pages/random.vue @@ -1,15 +1,18 @@