Advertisement
vandasche

Untitled

Apr 29th, 2020
27
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 item = this.props.consul;
  15. console.log(item);
  16. const reservation = item.data.map((item, index) => (
  17. <Data item={item} key={index} />
  18. ));
  19.  
  20. return (
  21. <>
  22. <Header />
  23. <div className='container margin-top pb-5'>
  24. <div className='row'>
  25. <div className='col'>
  26. <h5>Consultation</h5>
  27. {reservation}
  28. </div>
  29. </div>
  30. </div>
  31. </>
  32. );
  33. }
  34. }
  35.  
  36. const mapStateToProps = (state) => {
  37. return {
  38. consul: state.consultation,
  39. };
  40. };
  41.  
  42. export default connect(mapStateToProps)(user_reservation);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement