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() {
const { accounts, skin, allowAdd, allowLogout, highlightActiveAccount } = this.props;
const activeAccount = accounts.active;
let {available} = accounts;
if (highlightActiveAccount) {
available = available.filter((account) => account.id !== accounts.active.id);
available = available.filter((account) => account.id !== activeAccount.id);
}
return (
@ -65,19 +66,19 @@ export class AccountSwitcher extends Component {
)} />
<div className={styles.activeAccountInfo}>
<div className={styles.activeAccountUsername}>
{accounts.active.username}
{activeAccount.username}
</div>
<div className={classNames(styles.accountEmail, styles.activeAccountEmail)}>
{accounts.active.email}
{activeAccount.email}
</div>
<div className={styles.links}>
<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} />
</a>
</div>
<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} />
</a>
</div>

View File

@ -33,6 +33,10 @@ export default class User {
// frontend app specific attributes
isGuest: true,
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) => {