Advertisement
langbung01

Untitled

Sep 5th, 2018
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React, { Component } from 'react';
  2. import PropTypes from 'prop-types';
  3. import { bindActionCreators } from 'redux';
  4. import { connect } from 'react-redux';
  5.  
  6. import { fetchAccountInfo, fetchExpireLoa } from '../actions/update_profile';
  7. import UpdateProfileSidebar from '../components/UpdateProfileSidebar';
  8. import UpdateProfileRoute from '../components/UpdateProfileRoute';
  9. import UpdateProfileNotificationCenter from '../components/UpdateProfileNotificationCenter';
  10. import ComponentWithNotification from '../components/ComponentWithNotification';
  11.  
  12. class UpdateProfile extends Component {
  13.  
  14.   componentDidMount() {
  15.     this.props.fetchAccountInfo();
  16.     this.props.fetchExpireLoa();
  17.   }
  18.  
  19.   render() {
  20.     if (this.props.accountInfo.isLoad) {
  21.       return (
  22.         <ComponentWithNotification>
  23.           <div className="ibox-content sk-loading">
  24.             <div className="text-center">
  25.               <div className="sk-spinner sk-spinner-double-bounce">
  26.                 <div className="sk-double-bounce1" />
  27.                 <div className="sk-double-bounce2" />
  28.               </div>
  29.             </div>
  30.           </div>
  31.         </ComponentWithNotification>
  32.       );
  33.     }
  34.     return (
  35.       <ComponentWithNotification>
  36.         <UpdateProfileNotificationCenter />
  37.         <UpdateProfileSidebar />
  38.         <UpdateProfileRoute />
  39.       </ComponentWithNotification>
  40.     );
  41.   }
  42. }
  43.  
  44. UpdateProfile.propTypes = {
  45.   accountInfo: PropTypes.object.isRequired,
  46.   fetchAccountInfo: PropTypes.func.isRequired,
  47.   fetchExpireLoa: PropTypes.func.isRequired,
  48. };
  49.  
  50. function mapStateToProps({ accountInfo }) {
  51.   return { accountInfo };
  52. }
  53.  
  54. function mapDispatchToProps(dispatch) {
  55.   return bindActionCreators({ fetchAccountInfo, fetchExpireLoa }, dispatch);
  56. }
  57.  
  58. export default connect(mapStateToProps, mapDispatchToProps)(UpdateProfile);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement