Guest User

Untitled

a guest
Oct 22nd, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. componentDidMount() {
  2. console.log("MOUNT");
  3. $.ajax({
  4. url:"http://localhost:10774/sbrp-service/rest/grafico/viagens_municipio",
  5. dataType: 'json',
  6. success:function(resposta) {
  7. console.log(resposta);
  8.  
  9. const novaListaMedia = [];
  10. const novaListaMunicipio = [];
  11.  
  12. for (let i = 0; i < resposta.length; i++) {
  13. novaListaMedia.push(resposta[i].media);
  14. novaListaMunicipio.push(resposta[i].municipio);
  15. }
  16.  
  17. this.setState({
  18. listaMedia: novaListaMedia,
  19. listaMunicipio: novaListaMunicipio
  20. });
  21. }
  22. }.bind(this));
  23. };
Add Comment
Please, Sign In to add comment