componentDidMount() { petfinder.pet .find({ location: "Austin, TX", output: "full" }) .then(data => { let pets; if (data.petfinder.pets && data.petfinder.pets.pet) { if (Array.isArray(data.petfinder.pets.pet)) { pets = data.petfinder.pets.pet; } else { pets = [data.petfinder.pets.pet]; } } else { pets = []; } this.setState({ pets: pets }); }); }
petfinder.pet .find({ location: this.props.searchParams.location, animal: this.props.searchParams.animal, breed: this.props.searchParams.breed, output: "full" }) .then(data => { let pets; if (data.petfinder.pets && data.petfinder.pets.pet) { if (Array.isArray(data.petfinder.pets.pet)) { pets = data.petfinder.pets.pet; } else { pets = [data.petfinder.pets.pet]; } } else { pets = []; } this.setState({ pets: pets }); });