mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 23:45:44 +01:00
try to correct add permission
This commit is contained in:
@@ -14,10 +14,7 @@ import {
|
||||
createPermissionReset,
|
||||
getDeletePermissionsFailure
|
||||
} from "../modules/permissions";
|
||||
import {
|
||||
Loading,
|
||||
ErrorPage
|
||||
} from "@scm-manager/ui-components";
|
||||
import { Loading, ErrorPage } from "@scm-manager/ui-components";
|
||||
import type {
|
||||
Permission,
|
||||
PermissionCollection,
|
||||
@@ -66,11 +63,14 @@ class Permissions extends React.Component<Props> {
|
||||
}
|
||||
|
||||
permissionCreated = () => {
|
||||
const { namespace, repoName } = this.props;
|
||||
const { namespace, repoName, history } = this.props;
|
||||
console.log("fetch permissions!");
|
||||
//history.push(`/repo/${namespace}/${repoName}/permissions`);
|
||||
this.props.fetchPermissions(namespace, repoName);
|
||||
};
|
||||
|
||||
createPermission = (permission: Permission) => {
|
||||
console.log("create Permission");
|
||||
this.props.createPermission(
|
||||
permission,
|
||||
this.props.namespace,
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
|
||||
import { apiClient } from "@scm-manager/ui-components";
|
||||
import * as types from "../../modules/types";
|
||||
import type {
|
||||
Action
|
||||
} from "@scm-manager/ui-types";
|
||||
import type { Action } from "@scm-manager/ui-types";
|
||||
import type {
|
||||
PermissionCollection,
|
||||
Permission,
|
||||
@@ -234,8 +232,15 @@ export function createPermission(
|
||||
permission,
|
||||
CONTENT_TYPE
|
||||
)
|
||||
.then(() => {
|
||||
dispatch(createPermissionSuccess(permission, namespace, repoName));
|
||||
.then(response => {
|
||||
const location = response.headers.Location;
|
||||
return apiClient.get(location);
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(createdPermission => {
|
||||
dispatch(
|
||||
createPermissionSuccess(createdPermission, namespace, repoName)
|
||||
);
|
||||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user