Advertisement
Guest User

Untitled

a guest
Apr 19th, 2018
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. fetchData = async (dataURL, dictionaryURL) => {
  2.     let joinedData;
  3.     await fetch(dataURL)
  4.       .then(results => results.json())
  5.       .then(data => {
  6.         joinedData = data;
  7.         joinedData.forEach(element => {
  8.           if (this.state.statusDictionary[element.status] !== undefined)
  9.             element.status = this.state.statusDictionary[element.status];
  10.           else element.status = 'N/A';
  11.           if (this.state.osDictionary[element.os] !== undefined)
  12.             element.os = this.state.osDictionary[element.os];
  13.           else element.os = 'N/A';
  14.         });
  15.       });
  16.     this.setState({ tableData: joinedData });
  17.   };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement