NuxtMuhammad Awais

useAsyncData weird behavior

Hi guys, I'm experiencing a strange behavior. I'm using async data to call an API. But there is a condition for the component rendering that is calling async data. If user is loggedin then component renders otherwise not. Now problem is that when user log in from modal the async data doesn't await for the response to come infact returns null. Can anyone help me with that. Thanks in advance
No description
No description
KenZ17d ago
where was fetchConfiguration it might call wrong time
pyplacca17d ago
Your if condition might be the cause. You’re returning data when data has no value Also, I don’t see why you’d use useAsyncData inside an async function. You might want to use it as a top level composable or simply use fetch or axios in a try catch statement inside your async function