Добавлен проброс дополнительных данных на фронт в методе account/current

This commit is contained in:
ErickSkrauch 2016-03-12 01:02:52 +03:00
parent d725bc2bfe
commit 7b3d192132
2 changed files with 9 additions and 5 deletions

View File

@ -9,7 +9,7 @@ export class Category extends Component {
render() { render() {
var { user } = this.props; var { user } = this.props;
var changePassDate = Date.now() - (1000 * 60 * 60 * 24 * 30 * 3); console.log(user);
return ( return (
<div> <div>
@ -63,7 +63,7 @@ export class Category extends Component {
<div className={styles.paramRow}> <div className={styles.paramRow}>
<div className={styles.paramName}>Пароль:</div> <div className={styles.paramName}>Пароль:</div>
<div className={styles.paramValue}> <div className={styles.paramValue}>
Изменён <Relative value={changePassDate} /> Изменён <Relative value={user.passwordChangedAt} />
</div> </div>
<div className={styles.paramAction}> <div className={styles.paramAction}>
<a href="#"> <a href="#">
@ -94,7 +94,7 @@ export class Category extends Component {
<div className={styles.paramItem}> <div className={styles.paramItem}>
<div className={styles.paramRow}> <div className={styles.paramRow}>
<div className={styles.paramName}>UUID:</div> <div className={styles.paramName}>UUID:</div>
<div className={styles.uuidValue}>{user.uuid || 'df936908-b2e1-544d-96f8-2977ec213022'}</div> <div className={styles.uuidValue}>{user.uuid}</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -17,6 +17,7 @@ export default class User {
const defaults = { const defaults = {
id: null, id: null,
uuid: null,
token: '', token: '',
username: '', username: '',
email: '', email: '',
@ -24,7 +25,8 @@ export default class User {
goal: null, // the goal with wich user entered site goal: null, // the goal with wich user entered site
isGuest: true, isGuest: true,
isActive: true, isActive: true,
shouldChangePassword: false // TODO: нужно ещё пробросить причину необходимости смены shouldChangePassword: false, // TODO: нужно ещё пробросить причину необходимости смены
passwordChangedAt: null
}; };
const user = Object.keys(defaults).reduce((user, key) => { const user = Object.keys(defaults).reduce((user, key) => {
@ -51,10 +53,12 @@ export default class User {
export const userShape = PropTypes.shape({ export const userShape = PropTypes.shape({
id: PropTypes.number, id: PropTypes.number,
uuid: PropTypes.string,
token: PropTypes.string, token: PropTypes.string,
username: PropTypes.string, username: PropTypes.string,
email: PropTypes.string, email: PropTypes.string,
avatar: PropTypes.string, avatar: PropTypes.string,
isGuest: PropTypes.bool.isRequired, isGuest: PropTypes.bool.isRequired,
isActive: PropTypes.bool.isRequired isActive: PropTypes.bool.isRequired,
passwordChangedAt: PropTypes.number
}); });