Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- constructor(props) {
- super(props)
- this.state = {
- active: false,
- selected: undefined,
- dataSource: [],
- index: 0,
- routes: 'Lead In',
- isLoading: true,
- stage: 0
- };
- this.arrayholder = [];
- this.arrayholder2 = [];
- }
- doRequest = () => {
- // deal api
- fetch(deal_api)
- .then(response => response.json())
- .then(responseJson => {
- this.setState(
- {
- isLoading: false,
- dataSource: responseJson,
- },
- function() {
- let array = [];
- this.arrayholder = responseJson;
- if (arrayholder.length > 0){
- array.push(arrayholder)
- }
- }
- );
- })
- .catch(error => {
- console.error(error);
- });
- // organization api
- fetch(organization_api)
- .then(response => response.json())
- .then(responseJson => {
- this.arrayholder2 = responseJson;
- if (arrayholder2.length > 0){
- array.push(arrayholder2)
- }
- this.setState(
- {
- isLoading: false,
- dataSource: array,
- }
- );
- })
- .catch(error => {
- console.error(error);
- });
- console.log(dataSource)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement