Advertisement
Guest User

Untitled

a guest
May 27th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. import React, { Component } from 'react';
  2. import { Container, } from 'reactstrap';
  3. import AppNavbar from './AppNavbar';
  4.  
  5.  
  6. class Wallet extends Component {
  7.  
  8. constructor(props) {
  9. super(props);
  10. this.state = {users: [], isLoading: true};
  11. }
  12.  
  13. componentDidMount() {
  14. this.setState({isLoading: true});
  15.  
  16. fetch('/users')
  17. .then(response => response.json())
  18. .then(data => this.setState({users: data.content, isLoading: false}));
  19. }
  20.  
  21. render() {
  22. const {users, isLoading} = this.state;
  23.  
  24. if (isLoading) {
  25. return <p>Loading...</p>;
  26. }
  27.  
  28. const userList = users.map(user => {
  29. return <tr key={user.id}>
  30. <td style={{whiteSpace: 'nowrap'}}>{user.login}</td>
  31. <td>{user.password}</td>
  32.  
  33.  
  34. </tr>
  35. });
  36.  
  37. return (
  38. <div>
  39.  
  40. <div>
  41. <AppNavbar/>
  42. <Container fluid>
  43. <h5>ETH on this wallet: {Wallet.getBalance()} </h5>
  44.  
  45. </Container>
  46. </div>
  47.  
  48. </div>
  49.  
  50. );
  51. }
  52. }
  53.  
  54. export default Wallet;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement