diff options
Diffstat (limited to 'vnext/src/components')
-rw-r--r-- | vnext/src/components/Settings.js | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/vnext/src/components/Settings.js b/vnext/src/components/Settings.js index 2a24e35c..2f03671f 100644 --- a/vnext/src/components/Settings.js +++ b/vnext/src/components/Settings.js @@ -1,5 +1,7 @@ import React from 'react'; +import update from 'immutability-helper'; + import { me } from '../api'; import { UserType } from './Types'; @@ -39,9 +41,11 @@ export default class Settings extends React.Component { console.log('password update'); } emailChanged = (event) => { - this.setState({ - me: { activeEmail: event.target.value } + let newState = update(this.state, { + me: { activeEmail: {$set: event.target.value }} }); + this.setState(newState); + console.log('email update'); } disableTelegram = () => { console.log('telegram disable'); @@ -161,16 +165,16 @@ export default class Settings extends React.Component { {/** email_off **/} <form> You can receive notifications to email:<br /> - Sent to <select name="account" value={me.activeEmail} onChange={this.emailChanged}> + Sent to <select name="account" value={me.activeEmail || 'Disabled'} onChange={this.emailChanged}> <option value="">Disabled</option> - {me.emails.map(email => - <option key={email} value={email}> - {email} - </option> - )} + { + me.emails.map(email => + <option key={email} value={email}> + {email} + </option> + ) + } </select> - <input type="hidden" name="page" value="email-subscr" /> - <input type="submit" value="OK" /> </form> {/** /email_off **/} <p> </p> |