2018-07-18 17:40:05 +02:00
|
|
|
//@flow
|
|
|
|
|
import React from "react";
|
|
|
|
|
import { connect } from "react-redux";
|
|
|
|
|
import UserForm from "./UserForm";
|
|
|
|
|
import type { User } from "../types/User";
|
2018-07-25 13:21:49 +02:00
|
|
|
import { modifyUser } from "../modules/users";
|
2018-07-18 17:40:05 +02:00
|
|
|
|
|
|
|
|
type Props = {
|
2018-07-25 13:21:49 +02:00
|
|
|
user: User,
|
2018-07-19 12:05:50 +02:00
|
|
|
updateUser: User => void,
|
|
|
|
|
loading: boolean
|
2018-07-18 17:40:05 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class EditUser extends React.Component<Props> {
|
|
|
|
|
render() {
|
2018-07-25 13:21:49 +02:00
|
|
|
const { user, updateUser } = this.props;
|
|
|
|
|
return <UserForm submitForm={user => updateUser(user)} user={user} />;
|
2018-07-18 17:40:05 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const mapDispatchToProps = dispatch => {
|
|
|
|
|
return {
|
|
|
|
|
updateUser: (user: User) => {
|
2018-07-23 17:00:33 +02:00
|
|
|
dispatch(modifyUser(user));
|
2018-07-18 17:40:05 +02:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const mapStateToProps = (state, ownProps) => {
|
2018-07-25 13:21:49 +02:00
|
|
|
return {};
|
2018-07-18 17:40:05 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default connect(
|
|
|
|
|
mapStateToProps,
|
|
|
|
|
mapDispatchToProps
|
|
|
|
|
)(EditUser);
|