|
@@ -6,8 +6,8 @@ import ChangeEmailForm from './ChangeEmailForm/index';
|
|
|
import ChangePasswordForm from './changePassword/index'
|
|
|
import {changeLoginRequest} from '../../../actions/user/changelogin';
|
|
|
import {changeEmailRequest} from '../../../actions/user/changeEmail';
|
|
|
-import {changePasswordRequest } from '../../../actions/user/changePassword'
|
|
|
-
|
|
|
+import {changePasswordRequest } from '../../../actions/user/changePassword';
|
|
|
+import {myUserRequest} from '../../../actions/admin/meUser'
|
|
|
|
|
|
class ProfilePage extends React.Component {
|
|
|
|
|
@@ -16,6 +16,10 @@ class ProfilePage extends React.Component {
|
|
|
klick: false,
|
|
|
click: false
|
|
|
}
|
|
|
+ componentDidMount(){
|
|
|
+ const {myUserRequest} =this.props
|
|
|
+ myUserRequest()
|
|
|
+ }
|
|
|
|
|
|
handleClick = () => {
|
|
|
this.setState((prevState) => ({ clicked: !prevState.clicked }));
|
|
@@ -29,50 +33,40 @@ class ProfilePage extends React.Component {
|
|
|
|
|
|
render() {
|
|
|
|
|
|
- const { signIn:{data, token}, changeLoginRequest, chageLoginReducer, changeEmailRequest, changeEmailReducer, changePasswordRequest} = this.props;
|
|
|
- console.log(changeEmailReducer)
|
|
|
+ const { myUser:{data, token}, changeLoginRequest, chageLoginReducer, changeEmailRequest, changeEmailReducer, changePasswordRequest} = this.props;
|
|
|
const {clicked, klick, click} =this.state;
|
|
|
const {handleClick, handleClicks, handleClicked} = this;
|
|
|
|
|
|
|
|
|
return (
|
|
|
- <div className="page page--bottom-only profile-page">
|
|
|
- <div className="border bg-autumn-foliage m-5 rounded d-flex">
|
|
|
+ <div className="slideDown page page--bottom-only profile-page bg-img d-block w-100 slider-image padding" >
|
|
|
+ <div className="border bg-rgba rounded d-flex ">
|
|
|
<div>
|
|
|
- {/* <h5 className="p-2 font-po-bold flex-fill bd-highlight align-self-end">{data.name}</h5> */}
|
|
|
- {/* <div className="d-flex" >
|
|
|
- <p className="p-2 flex-fill font-po-bold bd-highlight align-self-end">Email</p><p className="p-2 flex-fill font-po-bold bd-highlight align-self-end">{data.email}</p>
|
|
|
- </div> */}
|
|
|
- {/* <div className="d-flex" >
|
|
|
- <p className="p-2 flex-fill font-po-bold bd-highlight align-self-end">Role</p><p className="p-2 flex-fill font-po-bold bd-highlight align-self-end">{data.role}</p>
|
|
|
- </div> */}
|
|
|
-
|
|
|
<div>
|
|
|
- <img className="m-4" src="https://cdn.iconscout.com/icon/free/png-256/avatar-373-456325.png" alt="banner" ></img>
|
|
|
+
|
|
|
+ <img className="m-4 " src=" https://ru.opensuse.org/images/0/0b/Icon-user.png" ></img>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div className="border-left bg-autumn-foliage m-5 rounded w-75 ">
|
|
|
+ <div className="border-left bg-autumn-foliage m-5 rounded w-75 text-white font-ci font-ci-bold">
|
|
|
{!clicked
|
|
|
?
|
|
|
<div className ="d-flex mb-3" >
|
|
|
-
|
|
|
- <h3 className = " p-2 flex-fill bd-highlight">Name</h3>
|
|
|
+ <h3 className = " p-2 flex-fill bd-highlight ">Name</h3>
|
|
|
<h5 className="p-2 font-po-bold flex-fill bd-highlight align-self-end">{
|
|
|
chageLoginReducer.data == null
|
|
|
?
|
|
|
- data.name
|
|
|
+ data&&data.name
|
|
|
:
|
|
|
chageLoginReducer.data
|
|
|
|
|
|
- }</h5>
|
|
|
- <button type="button" onClick ={handleClick} className=" flex-fill bg-shadow btn btn-outline-primary col-3">Change</button>
|
|
|
-
|
|
|
+
|
|
|
+ }</h5>
|
|
|
+ <button type="button" onClick ={handleClick} className=" flex-fill bg-shadow btn text-white font-ci font-ci-bold col-3">Change</button>
|
|
|
</div>
|
|
|
:
|
|
|
- <div>
|
|
|
- <h3 className="p-2 flex-fill bd-highlight">Name</h3>
|
|
|
- <h5 className="p-2 font-po-bold flex-fill bd-highlight align-self-end">{data.name}</h5>
|
|
|
- <ChangeLoginForm data ={data} token={token} actions ={{changeLoginRequest}} handlers={{ handleClick}}> </ChangeLoginForm>
|
|
|
+ <div className ="d-flex mb-3">
|
|
|
+ <h3 className = " p-2 flex-fill bd-highlight">Name</h3>
|
|
|
+ <ChangeLoginForm data ={data} initialValues={data} token={token} actions ={{changeLoginRequest}} handlers={{ handleClick}}> </ChangeLoginForm>
|
|
|
</div>
|
|
|
}
|
|
|
{!klick
|
|
@@ -83,18 +77,18 @@ class ProfilePage extends React.Component {
|
|
|
{
|
|
|
changeEmailReducer.data ===null
|
|
|
?
|
|
|
- data.email
|
|
|
+ data&&data.email
|
|
|
:
|
|
|
changeEmailReducer.data
|
|
|
- }
|
|
|
- </h5>
|
|
|
- <button type="button" name ="name" onClick ={handleClicks} className=" flex-fill bg-shadow btn btn-outline-primary col-3">Change</button>
|
|
|
+ }
|
|
|
+ </h5>
|
|
|
+ <button type="button" name ="name" onClick ={handleClicks} className=" flex-fill bg-shadow btn text-white font-ci font-ci-bold col-3">Change</button>
|
|
|
</div>
|
|
|
:
|
|
|
<div className ="d-flex mb-3" >
|
|
|
- <h3 className="p-2 flex-fill bd-highlight">Email</h3>
|
|
|
- <h5 className="p-2 flex-fill font-po-bold bd-highlight align-self-end">{data.email}</h5>
|
|
|
- <ChangeEmailForm data ={data} token={token} actions ={{changeEmailRequest}} handlers={{ handleClicks}}></ChangeEmailForm>
|
|
|
+
|
|
|
+ <h3 className = "p-2 flex-fill bd-highlight">Email</h3>
|
|
|
+ <ChangeEmailForm data ={data} token={token} initialValues={data} actions ={{changeEmailRequest}} handlers={{ handleClicks}}></ChangeEmailForm>
|
|
|
</div>
|
|
|
}
|
|
|
{
|
|
@@ -103,9 +97,9 @@ class ProfilePage extends React.Component {
|
|
|
<div className ="d-flex mb-3" >
|
|
|
|
|
|
<h3 className = "p-2 flex-fill bd-highlight">Password</h3>
|
|
|
- <button type="button" onClick ={handleClicked} className=" flex-fill bg-shadow btn btn-outline-primary col-3">Change</button>
|
|
|
- </div>
|
|
|
- :
|
|
|
+ <button type="button" onClick ={handleClicked} className=" flex-fill bg-shadow btn text-white font-ci font-ci-bold col-3">Change</button>
|
|
|
+ </div>
|
|
|
+ :
|
|
|
<div className ="d-flex mb-3" >
|
|
|
<h3 className = "p-2 flex-fill bd-highlight">Password</h3>
|
|
|
<ChangePasswordForm data ={data} token={token} actions ={{changePasswordRequest}} handlers={{ handleClicked}}></ChangePasswordForm>
|
|
@@ -115,8 +109,10 @@ class ProfilePage extends React.Component {
|
|
|
|
|
|
</div>
|
|
|
</div>
|
|
|
-
|
|
|
</div>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
)
|
|
|
}
|
|
@@ -125,11 +121,11 @@ class ProfilePage extends React.Component {
|
|
|
|
|
|
const
|
|
|
mapStateToProps = state => ({
|
|
|
- signIn: state.signIn,
|
|
|
+ myUser:state.myUser,
|
|
|
chageLoginReducer: state.chageLoginReducer,
|
|
|
changeEmailReducer:state.changeEmailReducer
|
|
|
});
|
|
|
|
|
|
-const mapDispatchToProps = dispatch => bindActionCreators({changeLoginRequest, changeEmailRequest, changePasswordRequest}, dispatch);
|
|
|
+const mapDispatchToProps = dispatch => bindActionCreators({changeLoginRequest, changeEmailRequest, changePasswordRequest, myUserRequest}, dispatch);
|
|
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(ProfilePage);
|