Toast Error not displaying

Want to pass an error toast if data is not found in the database but status response is 200.Below is what I implemented but does not show a toast
  const searchUser=useCallback(async()=>{
        
     
        const data = await supabase.from('profiles').select('name').eq('name',search)
        if(data){
        setCuser(data.data)
        }
        else{
            toast.error('User not found')
        }
        
    },[search])
Was this page helpful?