N
Nuxt4mo ago
afterdunk

useFetch unknown type when fetching api routes

hej, I use useFetch to fetch api routes from /server/api directory and I wonder how should I handle the types? Currently it's unknown like on the first screenshot. You can also see the api route that I'm fetching on the second screenshot. Does nuxt provide autogenerated interface type based on api route return type that I can pass to useFetch<here>() or am I missing something perhaps?
No description
No description
4 Replies
afterdunk
afterdunk4mo ago
whoops, I fixed it by changing
useFetch('/api/media/' + route.params.id)
useFetch('/api/media/' + route.params.id)
to
useFetch(`/api/media/${route.params.id}`)
useFetch(`/api/media/${route.params.id}`)
mathieu
mathieu5w ago
No description
mathieu
mathieu5w ago
No description
mathieu
mathieu5w ago
I have the same problem :/ But string interpolation does not seam to work does someone have an idea what could be wrong ?
Want results from more Discord servers?
Add your server