dyno-bot/Dyno-web-premium-before-reset/react/dashboard/common/SelectSetting.jsx
2020-09-12 19:08:48 +01:00

20 lines
611 B
JavaScript

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);
}
}
}