Restore accounts backward compatibility

This commit is contained in:
SleepWalker 2016-11-19 17:46:55 +02:00
parent 9fb7d62a21
commit 2653085f57
2 changed files with 10 additions and 5 deletions

View File

@ -44,11 +44,12 @@ export class AccountSwitcher extends Component {
render() { render() {
const { accounts, skin, allowAdd, allowLogout, highlightActiveAccount } = this.props; const { accounts, skin, allowAdd, allowLogout, highlightActiveAccount } = this.props;
const activeAccount = accounts.active;
let {available} = accounts; let {available} = accounts;
if (highlightActiveAccount) { if (highlightActiveAccount) {
available = available.filter((account) => account.id !== accounts.active.id); available = available.filter((account) => account.id !== activeAccount.id);
} }
return ( return (
@ -65,19 +66,19 @@ export class AccountSwitcher extends Component {
)} /> )} />
<div className={styles.activeAccountInfo}> <div className={styles.activeAccountInfo}>
<div className={styles.activeAccountUsername}> <div className={styles.activeAccountUsername}>
{accounts.active.username} {activeAccount.username}
</div> </div>
<div className={classNames(styles.accountEmail, styles.activeAccountEmail)}> <div className={classNames(styles.accountEmail, styles.activeAccountEmail)}>
{accounts.active.email} {activeAccount.email}
</div> </div>
<div className={styles.links}> <div className={styles.links}>
<div className={styles.link}> <div className={styles.link}>
<a href={`http://ely.by/u${accounts.active.id}`} target="_blank"> <a href={`http://ely.by/u${activeAccount.id}`} target="_blank">
<Message {...messages.goToEly} /> <Message {...messages.goToEly} />
</a> </a>
</div> </div>
<div className={styles.link}> <div className={styles.link}>
<a className={styles.link} onClick={this.onRemove(accounts.active)} href="#"> <a className={styles.link} onClick={this.onRemove(activeAccount)} href="#">
<Message {...messages.logout} /> <Message {...messages.logout} />
</a> </a>
</div> </div>

View File

@ -33,6 +33,10 @@ export default class User {
// frontend app specific attributes // frontend app specific attributes
isGuest: true, isGuest: true,
goal: null, // the goal with wich user entered site goal: null, // the goal with wich user entered site
// TODO: remove me after migration to multy accs
token: '',
refreshToken: ''
}; };
const user = Object.keys(defaults).reduce((user, key) => { const user = Object.keys(defaults).reduce((user, key) => {