plr.
plr.
NNuxt
Created by plr. on 9/11/2024 in #❓・help
How to fetch properly ?
thanks a lot
8 replies
NNuxt
Created by plr. on 9/11/2024 in #❓・help
How to fetch properly ?
Ohhh thx it was the SSL error I hadn't seen on my api !
8 replies
NNuxt
Created by plr. on 9/11/2024 in #❓・help
How to fetch properly ?
When i remove "await", it works, but only when i reload with hmr update
8 replies
NNuxt
Created by plr. on 9/11/2024 in #❓・help
How to fetch properly ?
That's my Numbers.vue file
8 replies
NNuxt
Created by plr. on 9/11/2024 in #❓・help
How to fetch properly ?
Yes ofc :
<script setup lang="ts">
let { data, status } = await useFetch('https://api.tnptrading.fr/home')
</script>

<template>
<div v-if="status == 'pending'">Chargement...</div>
<div v-else-if="status == 'error'">Erreur : {{ error }}</div>
<p v-else>{{ data }}</p>
</template>
<script setup lang="ts">
let { data, status } = await useFetch('https://api.tnptrading.fr/home')
</script>

<template>
<div v-if="status == 'pending'">Chargement...</div>
<div v-else-if="status == 'error'">Erreur : {{ error }}</div>
<p v-else>{{ data }}</p>
</template>
8 replies