moved edit and delete funcs

This commit is contained in:
Florian Scholdei
2019-02-06 11:44:03 +01:00
parent 2a830e4bc4
commit 1c03c91e21
9 changed files with 84 additions and 77 deletions

View File

@@ -3,11 +3,10 @@ import React from "react";
import { connect } from "react-redux";
import { withRouter } from "react-router-dom";
import RepositoryForm from "../components/form";
import DeleteRepo from "../components/DeleteRepo";
import DeleteRepo from "./DeleteRepo";
import type { Repository } from "@scm-manager/ui-types";
import {
modifyRepo,
deleteRepo,
isModifyRepoPending,
getModifyRepoFailure,
modifyRepoReset
@@ -22,7 +21,6 @@ type Props = {
modifyRepo: (Repository, () => void) => void,
modifyRepoReset: Repository => void,
deleteRepo: (Repository, () => void) => void,
// context props
repository: Repository,
@@ -41,14 +39,6 @@ class EditRepo extends React.Component<Props> {
history.push(`/repo/${repository.namespace}/${repository.name}`);
};
deleted = () => {
this.props.history.push("/repos");
};
delete = (repository: Repository) => {
this.props.deleteRepo(repository, this.deleted);
};
stripEndingSlash = (url: string) => {
if (url.endsWith("/")) {
return url.substring(0, url.length - 2);
@@ -86,7 +76,7 @@ class EditRepo extends React.Component<Props> {
props={extensionProps}
renderAll={true}
/>
<DeleteRepo repository={repository} delete={this.delete} />
<DeleteRepo repository={repository} />
</div>
);
}
@@ -109,9 +99,6 @@ const mapDispatchToProps = dispatch => {
},
modifyRepoReset: (repo: Repository) => {
dispatch(modifyRepoReset(repo));
},
deleteRepo: (repo: Repository, callback: () => void) => {
dispatch(deleteRepo(repo, callback));
}
};
};