Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. constructor() {
  2. super();
  3. this.state = {
  4. sds: []
  5. }
  6. }
  7.  
  8. componentDidMount() {
  9. axios.get('/userData', {
  10. params: {
  11. user: this.props.auth.user.name
  12. }
  13. }).then(res => {
  14. for(var i=0; i<res.data[0].chemID.split(',').length; i++){
  15. if(res.data[0].chemID.split(',')[i] != 0){
  16. axios.get('/chemData', {
  17. params: {
  18. id: res.data[0].chemID.split(',')[i]
  19. }
  20. //This is where I want to insert the data
  21. }).then(res => this.sds += ({
  22. id: i,
  23. title: res.data[0].chemName,
  24. selected: false,
  25. key: 'sds'
  26. }))
  27. }
  28. }
  29. })
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement