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