1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-08-02 03:20:15 +02:00

Fix settings updation for switches

This commit is contained in:
Kushagra Gour
2018-11-12 18:22:31 +05:30
parent 6776855cad
commit 29725026ee
5 changed files with 261 additions and 238 deletions

View File

@@ -887,15 +887,14 @@ export default class App extends Component {
/**
* Handles all user triggered preference changes in the UI.
*/
updateSetting(e) {
updateSetting(settingName, value) {
// If this was triggered from user interaction, save the setting
if (e) {
var settingName = e.target.dataset.setting;
if (settingName) {
// var settingName = e.target.dataset.setting;
var obj = {};
var el = e.target;
log(settingName, el.type === 'checkbox' ? el.checked : el.value);
log(settingName, value);
const prefs = { ...this.state.prefs };
prefs[settingName] = el.type === 'checkbox' ? el.checked : el.value;
prefs[settingName] = value;
obj[settingName] = prefs[settingName];
this.setState({ prefs });