From 6b91faa4e2273ad8a8c5b268064803480a527f94 Mon Sep 17 00:00:00 2001 From: Florian Scholdei Date: Fri, 17 May 2019 16:31:01 +0200 Subject: [PATCH] fix dispatch function and loading prop --- .../config/roles/containers/EditRepositoryRole.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/scm-ui/src/config/roles/containers/EditRepositoryRole.js b/scm-ui/src/config/roles/containers/EditRepositoryRole.js index f4badd9193..6dc783bec3 100644 --- a/scm-ui/src/config/roles/containers/EditRepositoryRole.js +++ b/scm-ui/src/config/roles/containers/EditRepositoryRole.js @@ -23,21 +23,16 @@ type Props = { history: History, //dispatch function - updateRole: ( - link: string, - role: RepositoryRole, - callback?: () => void - ) => void + updateRole: (role: RepositoryRole, callback?: () => void) => void }; class EditRepositoryRole extends React.Component { - repositoryRoleUpdated = (role: RepositoryRole) => { - const { history } = this.props; - history.push("/config/roles/"); + repositoryRoleUpdated = () => { + this.props.history.push("/config/roles/"); }; updateRepositoryRole = (role: RepositoryRole) => { - this.props.updateRole(role, () => this.repositoryRoleUpdated(role)); + this.props.updateRole(role, this.repositoryRoleUpdated); }; render() { @@ -60,7 +55,7 @@ class EditRepositoryRole extends React.Component { } const mapStateToProps = (state, ownProps) => { - const loading = isModifyRolePending(state); + const loading = isModifyRolePending(state, ownProps.role.name); const error = getModifyRoleFailure(state, ownProps.role.name); return {