'React GET API getting data before api call

This code is the code that receives and displays each list. I want to get a property from the listing data and put the value in the url. The value is well displayed as data.propertyType in the console. How can I get the property in each data and put it in the url?

class ListingPage extends React.Component {
constructor(props) {
    super(props);

    this.state = {
      id: props.params.id,
      listing: null,
    };

  }
  componentDidMount() {
    ListingAction.get(this.state.id, this.state.property);
  }
}

class ListingAction {
 get(listingId, property) {
    const listingFetch = data => {
      AppDispatcher.dispatch({
        actionType: Constants.LISTING_FETCH,
        data,
        
      });
      console.log(data);
      property.push(data.propertyType);
      console.log(property);
    };
    
    ListingService.get(listingId, property)
      .done(data => {
        listingFetch(data);
        
        console.log(data.propertyType);
        console.log(property);
      })
      .fail(data => {
        AppDispatcher.dispatch({
          actionType: Constants.LISTING_FETCH_FAILED,
        });
      });
  }
class ListingService {
  get(listingId, property) {
    return $.ajax({
      url: `/data/property/${listingId}?property=${property}`,
      data: { property },
      method: 'GET',
      cache: false,
    });
  }
}

}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source