|
@@ -1,19 +1,10 @@
|
|
|
import React from 'react';
|
|
|
import { connect } from 'react-redux';
|
|
|
import { bindActionCreators } from 'redux'
|
|
|
- import ChangeLoginForm from './ChangeLoginForm/index';
|
|
|
+import ChangeLoginForm from './ChangeLoginForm/index';
|
|
|
+import {changeLoginRequest} from '../../../actions/user/changelogin'
|
|
|
+
|
|
|
|
|
|
-const user = {
|
|
|
- "data": {
|
|
|
- "_id": "5c48461c40ca670017ba5974",
|
|
|
- "name": "Debil",
|
|
|
- "email": "superus@lol.com",
|
|
|
- "password": "$2a$10$qoxrQ2Sp3BDTLa9Xdc0ZPuLVHamipMQRWxeWxw1RwthICnbPoFLvC",
|
|
|
- "profilePhoto": "",
|
|
|
- "role": 0
|
|
|
- },
|
|
|
- "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVjNDg0NjFjNDBjYTY3MDAxN2JhNTk3NCIsInJvbGUiOjAsImlhdCI6MTU0ODI1NTczMiwiZXhwIjoxNTQ4MzQyMTMyfQ.RAIiCLjBJ2u1VEQWy1oUgPjHj0dZRG27l0J3c8FDss0"
|
|
|
-}
|
|
|
|
|
|
class ProfilePage extends React.Component {
|
|
|
state={
|
|
@@ -25,43 +16,54 @@ class ProfilePage extends React.Component {
|
|
|
}
|
|
|
|
|
|
render() {
|
|
|
- const { users, userChangeRequest, passwordChangeRequest } = this.props;
|
|
|
- const { data } = user;
|
|
|
+ const { signIn:{data, token}, changeLoginRequest, changeLogin} = this.props;
|
|
|
+ console.log(changeLogin)
|
|
|
const {clicked} =this.state;
|
|
|
+ const {handleClick} = this;
|
|
|
|
|
|
return (
|
|
|
<div className="page page--bottom-only profile-page">
|
|
|
- <section className="border bg-autumn-foliage m-5 rounded d-flex">
|
|
|
+ <div className="border bg-autumn-foliage m-5 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" ></img>
|
|
|
</div>
|
|
|
+ </div>
|
|
|
<div className="border-left bg-autumn-foliage m-5 rounded w-75 ">
|
|
|
{!clicked
|
|
|
?
|
|
|
<div className ="d-flex mb-3" >
|
|
|
<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>
|
|
|
- <button type="button" onClick ={this.handleClick} className=" flex-fill bg-shadow btn btn-outline-light col-3">Change</button>
|
|
|
+ <button type="button" onClick ={handleClick} className=" flex-fill bg-shadow btn btn-outline-primary 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> </ChangeLoginForm>
|
|
|
+ <ChangeLoginForm data ={data} token={token} actions ={{changeLoginRequest}} handlers={{ handleClick}}> </ChangeLoginForm>
|
|
|
</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>
|
|
|
- <button type="button" className=" flex-fill bg-shadow btn btn-outline-light col-3">Change</button>
|
|
|
+ <button type="button" className=" flex-fill bg-shadow btn btn-outline-primary col-3">Change</button>
|
|
|
</div>
|
|
|
<div className ="d-flex mb-3" >
|
|
|
<h3 className = "p-2 flex-fill bd-highlight">Password</h3>
|
|
|
- <button type="button" className=" flex-fill bg-shadow btn btn-outline-light col-3">Change</button>
|
|
|
+ <button type="button" className=" flex-fill bg-shadow btn btn-outline-primary col-3">Change</button>
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
- </section>
|
|
|
+ </div>
|
|
|
<section className="container section section--stats">
|
|
|
<div className="section__element section__element--">
|
|
|
<h3>Member Since</h3>
|
|
@@ -82,7 +84,8 @@ class ProfilePage extends React.Component {
|
|
|
</p>
|
|
|
</div>
|
|
|
</section>
|
|
|
- </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
)
|
|
|
}
|
|
|
|
|
@@ -90,10 +93,10 @@ class ProfilePage extends React.Component {
|
|
|
|
|
|
const
|
|
|
mapStateToProps = state => ({
|
|
|
- user: state.user,
|
|
|
- users: state.users
|
|
|
+ signIn: state.signIn,
|
|
|
+ changeLogin: state.changeLogin
|
|
|
});
|
|
|
|
|
|
-const mapDispatchToProps = dispatch => bindActionCreators({}, dispatch);
|
|
|
+const mapDispatchToProps = dispatch => bindActionCreators({changeLoginRequest}, dispatch);
|
|
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(ProfilePage);
|