JSON - Add status to JSON

0 votes
225 views
added Jul 5, 2018 in API by anonymous
edited Jul 13, 2018 by LC Marshal
// get list of units
(async () => {
let status = null;      
if(this.actionType === 'buy') {
  status = 1;
} else if(this.actionType === 'fund') {
  status = 2;
}

let apiUrl = `${mainSiteUrl}/api/property-units.json?property_nid=${this.pid}`;
if(status) apiUrl += `&status=${status}`;

const { data } = await this.axios.get(apiUrl);

this.setListOfUnits(data);
})();
lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...