Maybe put this API call inside the if block below so that you don't have to make unnecessary API calls?