Skip to content

Instantly share code, notes, and snippets.

@zishe
Created August 10, 2019 15:06
Show Gist options
  • Save zishe/1f5785e649a55c7bd4e7f8ec7c68e475 to your computer and use it in GitHub Desktop.
Save zishe/1f5785e649a55c7bd4e7f8ec7c68e475 to your computer and use it in GitHub Desktop.
componentDidMount() {
document.title = 'Companies';
this.loadData();
}
async loadData() {
await this.getLocations();
await this.getIndustries();
await this.getCompanySizes();
// await this.getFundings();
this.getCompanies();
}
async getCompanySizes() {
const data = await getBackJsonByPath('api/companySizes');
this.setState({
dataCompanySizes: data
.filter(x => x.name !== '1-50')
.map(x => ({ name: x.name, id: x.id, selected: false }))
});
}
// async getFundings() {
// const data = await getBackJsonByPath('Fundings/all');
// this.setState({ dataFundings: data.map(x => ({ name: x.name, id: x.id, selected: false })) });
// }
async getLocations() {
const data = await getBackJsonByPath('locations/usedForCompanies');
const allItems = data.map(x => ({ name: x.metroLocation, id: x.id }));
const names = _.uniq(allItems.map(x => x.name));
const items = names.map((x, i) => ({ name: x, id: i, selected: false }));
items.push(moreComingItem);
this.setState({ dataLocations: items, allLocations: allItems });
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment