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

19 lines
715 B
React
Raw Normal View History

2020-09-12 20:08:48 +02:00
import React from 'react';
import RichSelect from './RichSelect.jsx';
import { updateModuleSetting } from '../service/dashboardService.js';
export default class RichSettingSelect extends RichSelect {
handleChange = async (selectedOption) => {
const value = selectedOption && selectedOption.value ? selectedOption.value : false;
const label = selectedOption && selectedOption.label ? selectedOption.label : false;
await this.setState({ hasChanged: true, selectedOption: selectedOption || false });
updateModuleSetting(this.props.module, this.props.setting, value || null, this.props.friendlyName, label || null);
if (this.props.onChange) {
this.props.onChange(this.props, selectedOption);
}
}
}