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

22 lines
558 B
React
Raw Permalink Normal View History

2020-09-12 20:08:48 +02:00
import React from 'react';
import { removeModuleItem } from '../service/dashboardService.js';
export default class RemoveModuleItem extends React.Component {
constructor(props) {
super(props);
this.onClick = this.onClick.bind(this);
}
async onClick() {
if (this.props.onClick) {
this.props.onClick(this.props.identifier);
} else {
removeModuleItem(this.props.module, this.props.setting, this.props.identifier, this.props.friendlyName);
}
}
render() {
return (<a className='button is-danger' onClick={this.onClick}>Remove</a>);
}
}