mirror of
https://github.com/rjNemo/meal_planner
synced 2026-06-12 13:26:45 +00:00
faetch from api
This commit is contained in:
parent
df4c28235c
commit
b17abd0cd4
3 changed files with 21 additions and 1 deletions
1
TODO.md
1
TODO.md
|
|
@ -7,6 +7,7 @@
|
||||||
- [ ] deploy
|
- [ ] deploy
|
||||||
- [ ] nuxt image
|
- [ ] nuxt image
|
||||||
- [x] prettier and eslint
|
- [x] prettier and eslint
|
||||||
|
- [ ] transition
|
||||||
- [ ] pwa
|
- [ ] pwa
|
||||||
- [ ] seo, robots.txt
|
- [ ] seo, robots.txt
|
||||||
- [ ] update the README
|
- [ ] update the README
|
||||||
|
|
|
||||||
|
|
@ -9,4 +9,11 @@ export default defineNuxtConfig({
|
||||||
autoprefixer: {},
|
autoprefixer: {},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
runtimeConfig: {
|
||||||
|
// The private keys which are only available server-side
|
||||||
|
apiUrl: process.env.API_URL,
|
||||||
|
// Keys within public are also exposed client-side
|
||||||
|
public: {},
|
||||||
|
},
|
||||||
|
ssr: true,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,15 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
const { data, pending, error, refresh } = await useFetch(
|
||||||
|
"https://www.themealdb.com/api/json/v1/1/random.php",
|
||||||
|
);
|
||||||
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>random</div>
|
<div>
|
||||||
|
<div v-if="pending">Loading</div>
|
||||||
|
<div v-else-if="error">Failed: {{ error }}</div>
|
||||||
|
<pre v-else>
|
||||||
|
{{ data?.meals?.[0] }}
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue