123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- import React, { Component, Fragment } from 'react';
- import { getUsersDataById } from "../actions/getUserById"
- import { getCategoriesData } from '../actions/categoryAction';
- import { getStaffsDataById } from "../actions/getStaffByIdAction"
- import { pushPhoto, inputchangeHandler, inputchangeHandler1, inputchangeHandler2, inputchangeHandler3, EditStaffAction, closeModal } from "../actions/addNewStaffAction";
- import FormRedactorStaff from '../components/FormsAdd/redForm'
- import EditModal from "../components/Modal/addNewStaffModal";
- import { connect} from 'react-redux';
- import { bindActionCreators } from "redux";
- class redactorForm extends Component {
-
-
-
-
-
- componentDidMount(){
- const { getStaffsDataById, match, getUsersDataById } = this.props
- getStaffsDataById(match.params.id)
- this.props.getCategoriesData();
- let localS = JSON.parse(localStorage.getItem("login"));
- if(localS===null){
- }
- else{
- getUsersDataById(localS)
- }
- }
- closeEditModal = () => {
- const { closeModal } = this.props;
- closeModal();
- }
- render() {
- const { allCategory } = this.props
- const str = "Объявление успешно отредактировано"
- let data;
- if (allCategory.data===undefined){
- data = []
- }
- else{
- data = <Fragment>
- <FormRedactorStaff {...this.props}/>
- <EditModal visible={this.props.showModal}
- onOk={this.closeEditModal}
- onCancel={this.closeEditModal}
-
- str={ str }
- />
- </Fragment>
- }
-
- return (
- <div>
- {data}
- </div>
- );
- }
- }
- const mapStateToProps = state => ({
- allCategory: state.category.allCategory,
- InfoStaff: state.staffById.infoStaffs,
- isFetching: state.staffById.isFetching,
- getUser: state.getUserById.getUser,
- photo: state.addStaff.photo,
- inputData: state.addStaff.inputData,
- inputData1: state.addStaff.inputData1,
- inputData2: state.addStaff.inputData2,
- inputData3: state.addStaff.inputData3,
- showModal: state.addStaff.showModal,
- });
-
- const mapDispatchToProps = dispatch => bindActionCreators({ closeModal, getUsersDataById, getStaffsDataById, getCategoriesData, pushPhoto, inputchangeHandler, inputchangeHandler1, inputchangeHandler2, inputchangeHandler3, EditStaffAction }, dispatch);
-
- export default redactorForm = connect(
- mapStateToProps,
- mapDispatchToProps
- )(redactorForm);
|