nkmnz
Where to handle 404 in useAsyncData?
Hey folks, I have a simple composable that uses fetch to get some authorized data:
I use it in
useAsyncData
like this:
Sometimes, the job requested is no longer available, so the api returns a 404 not found. Unfortunately, this leads to nuxt throwing a 500 error during SSR and there is no way for me to catch that error – no matter how many try{}catch(e){}
I wrap around
- the $fetch
request inside useApiFetch
- the useAsyncData
call
- the useApiFetch
inside of the useAsyncData
I always get this:
I'm out of my depth here, any help would be greatly appreaciated 🙏🏻6 replies