Files
SCM-Manager/scm-ui/src/users/containers/DeleteUserButton.js

37 lines
638 B
JavaScript
Raw Normal View History

2018-07-10 15:18:37 +02:00
// @flow
import React from "react";
type Props = {
user: any,
2018-07-10 16:37:27 +02:00
deleteUser: (link: string) => void
2018-07-10 15:18:37 +02:00
};
class DeleteUser extends React.Component<Props> {
deleteUser = () => {
2018-07-10 16:37:27 +02:00
this.props.deleteUser(this.props.user._links.delete.href);
2018-07-10 15:18:37 +02:00
};
2018-07-10 16:37:27 +02:00
if(deleteButtonClicked) {
let deleteButtonAsk = <div>You really want to remove this user?</div>
2018-07-10 15:18:37 +02:00
}
2018-07-10 16:37:27 +02:00
isDeletable = () => {
return this.props.user._links.delete;
2018-07-10 15:18:37 +02:00
};
2018-07-10 16:37:27 +02:00
render() {
if (!this.isDeletable()) {
return;
2018-07-10 15:18:37 +02:00
}
2018-07-10 16:37:27 +02:00
return (
<button type="button" onClick={this.deleteUser}>
Delete User
</button>
);
}
}
2018-07-10 15:18:37 +02:00
2018-07-10 16:37:27 +02:00
export default DeleteUser;