dyno-bot/Dyno-web-premium-before-reset/react/dashboard/common/SelectSetting.jsx

20 lines
611 B
React
Raw Normal View History

2020-09-12 20:08:48 +02:00
import React from 'react';
import Select from './Select.jsx';
import { updateModuleSetting } from '../service/dashboardService.js';
export default class SelectSetting extends Select {
constructor() {
super();
this.onChange = this.onChange.bind(this);
}
async onChange(event) {
const option = event.target.selectedOptions[0];
updateModuleSetting(this.props.module, this.props.setting, event.target.value, this.props.friendlyName, option.dataset.name);
this.setState({ name: option.dataset.name, value: event.target.value });
if (this.props.onChange) {
this.props.onChange(event);
}
}
}