mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-01 15:09:14 +00:00
fix:Do not repeatedly delete requests to the server (#4622)
This commit is contained in:
@@ -12,16 +12,26 @@ const propTypes = {
|
||||
|
||||
class DeleteRepoDialog extends Component {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
isRequestSended: false,
|
||||
};
|
||||
}
|
||||
|
||||
toggle = () => {
|
||||
this.props.toggle();
|
||||
}
|
||||
|
||||
onDeleteRepo = () => {
|
||||
this.props.onDeleteRepo(this.props.repo);
|
||||
this.setState({isRequestSended: true}, () => {
|
||||
this.props.onDeleteRepo(this.props.repo);
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
const { isRequestSended } = this.state;
|
||||
const repo = this.props.repo;
|
||||
const repoName = '<span class="op-target">' + Utils.HTMLescape(repo.repo_name || repo.name) + '</span>';
|
||||
let message = gettext('Are you sure you want to delete %s ?');
|
||||
@@ -35,7 +45,7 @@ class DeleteRepoDialog extends Component {
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
<Button color="secondary" onClick={this.toggle}>{gettext('Cancel')}</Button>
|
||||
<Button color="primary" onClick={this.onDeleteRepo}>{gettext('Delete')}</Button>
|
||||
<Button color="primary" disabled={isRequestSended} onClick={this.onDeleteRepo}>{gettext('Delete')}</Button>
|
||||
</ModalFooter>
|
||||
</Modal>
|
||||
);
|
||||
|
Reference in New Issue
Block a user