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

19 lines
715 B
JavaScript

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