refactor / enable routing after createRepoRole

This commit is contained in:
Eduard Heimbuch
2019-05-15 16:57:28 +02:00
parent 6c627bfe00
commit 60cf070c44
5 changed files with 10 additions and 16 deletions

View File

@@ -19,14 +19,14 @@ type Props = {
repositoryRolesLink: string,
//dispatch function
addRole: (link: string, role: Role) => void
addRole: (link: string, role: Role, callback?: () => void) => void
};
class CreateRepositoryRole extends React.Component<Props> {
//Callback after dispatch
repositoryRoleCreated = (role: Role) => {
const { history } = this.props;
history.push("/role/" + role.name);
history.push("/config/role/" + role.name);
};
createRepositoryRole = (role: Role) => {
@@ -63,8 +63,8 @@ const mapStateToProps = (state, ownProps) => {
const mapDispatchToProps = dispatch => {
return {
addRole: (link: string, role: Role) => {
dispatch(createRole(link, role));
addRole: (link: string, role: Role, callback?: () => void) => {
dispatch(createRole(link, role, callback));
}
};
};
@@ -72,4 +72,4 @@ const mapDispatchToProps = dispatch => {
export default connect(
mapStateToProps,
mapDispatchToProps
)(translate("roles")(CreateRepositoryRole));
)(translate("config")(CreateRepositoryRole));