Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. componentDidMount() {
  2. const { actions } = this.props;
  3.  
  4. this.increase = this.increase.bind(this);
  5.  
  6. // api call from the saga
  7. actions.surveyAnswersRequest();
  8.  
  9. // set breadcrumb
  10. actions.setBreadcrumb([{ title: 'Score' }]);
  11. actions.setTitle('Score');
  12. this.increase();
  13. }
  14.  
  15. render() {
  16. const { global, gallery, survey_answers, survey, survey_actual_answers } = this.props;
  17.  
  18. if (global.isFetching) {
  19. return <Loading />;
  20. }
  21. return this.view({ gallery, survey_answers, survey, survey_actual_answers });
  22. }
  23.  
  24. Score.propTypes = {
  25. actions: PropTypes.object.isRequired,
  26. global: PropTypes.object.isRequired,
  27. survey: PropTypes.object.isRequired,
  28. survey_answers: PropTypes.object.isRequired,
  29. gallery: PropTypes.object.isRequired,
  30. survey_actual_answers: PropTypes.array.isRequired,
  31. survey_score_system: PropTypes.array.isRequired,
  32. survey_styles: PropTypes.object.isRequired,
  33. survey_general_doc_data: PropTypes.object.isRequired
  34. };
  35.  
  36. function mapStateToProps(state, ownProps) {
  37. return {
  38. ...ownProps,
  39. global: state.global,
  40. gallery: state.gallery,
  41. survey: state.survey,
  42. survey_actual_answers: state.survey.survey_actual_answers,
  43. survey_answers: state.survey.survey_answers,
  44. survey_score_system: state.survey.survey_score_system,
  45. survey_styles: state.survey.survey_styles,
  46. survey_general_doc_data: state.survey.survey_general_doc_data,
  47. isFetching: state.isFetching
  48. };
  49. }
  50.  
  51. function mapDispatchToProps(dispatch) {
  52. return {
  53. actions: bindActionCreators({
  54. ...globalActions,
  55. ...galleryActions,
  56. ...surveyActions
  57. }, dispatch)
  58. };
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement