Guest User

Untitled

a guest
Aug 22nd, 2019
82
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. componentDidMount() {
  2. document.title = 'Companies';
  3.  
  4. this.loadData();
  5. }
  6.  
  7. async loadData() {
  8. await this.getLocations();
  9. await this.getIndustries();
  10. await this.getCompanySizes();
  11. // await this.getFundings();
  12. this.getCompanies();
  13. }
  14.  
  15. async getCompanySizes() {
  16. const data = await getBackJsonByPath('api/companySizes');
  17. this.setState({
  18. dataCompanySizes: data
  19. .filter(x => x.name !== '1-50')
  20. .map(x => ({ name: x.name, id: x.id, selected: false }))
  21. });
  22. }
  23.  
  24. // async getFundings() {
  25. // const data = await getBackJsonByPath('Fundings/all');
  26. // this.setState({ dataFundings: data.map(x => ({ name: x.name, id: x.id, selected: false })) });
  27. // }
  28.  
  29. async getLocations() {
  30. const data = await getBackJsonByPath('locations/usedForCompanies');
  31. const allItems = data.map(x => ({ name: x.metroLocation, id: x.id }));
  32.  
  33. const names = _.uniq(allItems.map(x => x.name));
  34. const items = names.map((x, i) => ({ name: x, id: i, selected: false }));
  35. items.push(moreComingItem);
  36.  
  37. this.setState({ dataLocations: items, allLocations: allItems });
  38. }
RAW Paste Data