Advertisement
vandasche

Untitled

Apr 29th, 2020
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. import React, { Component } from 'react';
  2. import Header from '../components/login';
  3. import Data from '../components/reservation_data';
  4. import { connect } from 'react-redux';
  5. import * as actConsult from '../_actions/consult';
  6.  
  7. class user_reservation extends Component {
  8. componentDidMount() {
  9. const data = JSON.parse(localStorage.getItem('credentials'));
  10. this.props.dispatch(actConsult.getConsult(data.token));
  11. }
  12.  
  13. render() {
  14. const { data: consul } = this.props.consul;
  15.  
  16. return (
  17. <>
  18. <Header />
  19. <div className='container margin-top pb-5'>
  20. <div className='row'>
  21. <div className='col'>
  22. <h5>Consultation</h5>
  23. {consul &&
  24. consul.length > 0 &&
  25. consul.map((item, index) => <Data item={item} key={index} />)}
  26. </div>
  27. </div>
  28. </div>
  29. </>
  30. );
  31. }
  32. }
  33.  
  34. const mapStateToProps = (state) => {
  35. return {
  36. consul: state.consultation,
  37. };
  38. };
  39.  
  40. export default connect(mapStateToProps)(user_reservation);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement