Can't access property on API from petfinder

362 Views Asked by At

I'm trying to pull data from the Petfinder API. I get a good response and can see the properties available but as soon as I try and access the pets property I get an error. I'm grabbing the promise fine but clearly messing up somewhere else. Hoping someone can help me figure out what i'm doing wrong.

Here is the code and what the promise returns

console.log(this.props.pets.petfinder)

Then as soon as I add .pets to the r

Here is the code that causes the error

console.log(this.props.pets.petfinder.pets)

enter image description here

Here is the action that is calling the api

export const getPets = () => {
    const myInits = {
    method: 'GET',
    mode: 'no-cors'
  }
  const promise = axios.get('http://api.petfinder.com/pet.find?key=mykey&format=json&location=85282', myInits)
  return {
      type: GET_PETS,
      payload: promise
  }
}
0

There are 0 best solutions below