Created
August 10, 2019 15:06
-
-
Save chatman-media/1f5785e649a55c7bd4e7f8ec7c68e475 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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