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

22 lines
558 B
JavaScript

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