import React, {useEffect} from 'react';
import {connect} from 'react-redux';
import style from './contactInfo.module.sass';
import UpdateProfileForm from '../../updateProfileForm/updateProfileForm';
import {getPersonalUserData} from "../../../../../actions/actionCreator";

const ContactInfo = (props) => {

    useEffect(() => {
        props.getPersonalUserData();
    }, []);


    return(
        <div className={style.mainContainer}>
            <h1>Редактирование личных данных</h1>
            <UpdateProfileForm/>
        </div>
    );
};

const mapStateToProps = state => {
    const {data} = state.userPersonalDataReducer;

    return {
        data
    }
};

const mapDispatchToProps = dispatch => ({
    getPersonalUserData: () => dispatch(getPersonalUserData())
});

export default connect(mapStateToProps, mapDispatchToProps)(ContactInfo);