aboutsummaryrefslogtreecommitdiff
path: root/vnext
diff options
context:
space:
mode:
Diffstat (limited to 'vnext')
-rw-r--r--vnext/package.json1
-rw-r--r--vnext/src/components/Settings.js24
-rw-r--r--vnext/yarn.lock6
3 files changed, 21 insertions, 10 deletions
diff --git a/vnext/package.json b/vnext/package.json
index 89800abd0..5f9de60e1 100644
--- a/vnext/package.json
+++ b/vnext/package.json
@@ -69,6 +69,7 @@
},
"dependencies": {
"axios": "^0.18.0",
+ "immutability-helper": "^2.7.1",
"moment": "^2.22.2",
"query-string": "^6.1.0",
"react": "^16.4.2",
diff --git a/vnext/src/components/Settings.js b/vnext/src/components/Settings.js
index 2a24e35ca..2f03671f1 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>&nbsp;</p>
diff --git a/vnext/yarn.lock b/vnext/yarn.lock
index f496a8e81..f69bd0eea 100644
--- a/vnext/yarn.lock
+++ b/vnext/yarn.lock
@@ -3557,6 +3557,12 @@ ignore@^4.0.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.2.tgz#0a8dd228947ec78c2d7f736b1642a9f7317c1905"
+immutability-helper@^2.7.1:
+ version "2.7.1"
+ resolved "https://registry.yarnpkg.com/immutability-helper/-/immutability-helper-2.7.1.tgz#5636dbb593e3deb5e572766d42249ea06bae7640"
+ dependencies:
+ invariant "^2.2.0"
+
import-cwd@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/import-cwd/-/import-cwd-2.1.0.tgz#aa6cf36e722761285cb371ec6519f53e2435b0a9"