diff --git a/src/forge/New/Index.js b/src/forge/New/Index.js index 8916fbbe4..24e9ccadd 100644 --- a/src/forge/New/Index.js +++ b/src/forge/New/Index.js @@ -150,7 +150,7 @@ class Index extends Component { isSpin: false }) this.props.showNotification(`${projectsType === "deposit" ? "托管" : "镜像"}项目创建成功!`); - this.props.history.push(`/projects/${result.data.id}/coders`); + this.props.history.push(`/projects/${current_user && current_user.login}/${result.data.identifier}/coders`); } } }).catch((error) => { diff --git a/src/forge/Settings/Collaborator.js b/src/forge/Settings/Collaborator.js index 6623f0ac5..a266828fb 100644 --- a/src/forge/Settings/Collaborator.js +++ b/src/forge/Settings/Collaborator.js @@ -86,9 +86,8 @@ class Collaborator extends Component { // 获取项目协作者 getMember = () => { const { page, search, role } = this.state; - console.log("search", search); - console.log("role", role); - const url = `/projects/${this.props.project_id}/members.json`; + const {projectsId ,owner} = this.props.match.params; + const url = `/${owner}/${projectsId}/collaborators.json`; axios .get(url, { params: { @@ -171,13 +170,14 @@ class Collaborator extends Component { // 增加协作者 addCollaborator = () => { // const { project_id } = this.props; - this.setState({ - otherSpin: true, - }); const { user_id } = this.state; - const url = `/projects/${this.props.project_id}/members.json`; - axios - .post(url, { + if(user_id){ + this.setState({ + otherSpin: true, + }); + const {projectsId ,owner} = this.props.match.params; + const url = `/${owner}/${projectsId}/collaborators.json`; + axios.post(url, { user_id, }) .then((result) => { @@ -196,6 +196,7 @@ class Collaborator extends Component { }); console.log(error); }); + } }; // 修改权限 @@ -204,7 +205,9 @@ class Collaborator extends Component { this.setState({ isSpin: true, }); - const url = `/projects/${this.props.project_id}/members/change_role.json`; + const {projectsId ,owner} = this.props.match.params; + + const url = `/${owner}/${projectsId}/collaborators/change_role.json`; axios .put(url, { user_id: id, @@ -230,11 +233,12 @@ class Collaborator extends Component { // 删除协作者 deleteUser = (id) => { const { page } = this.state; + const {projectsId ,owner} = this.props.match.params; this.props.confirm({ content: "确认将此成员从项目中移除?", onOk: () => { const { project_id } = this.props; - const url = `/projects/${project_id}/members/remove.json`; + const url = `/${owner}/${projectsId}/members/remove.json`; axios .delete(url, { data: { diff --git a/src/forge/Settings/Setting.js b/src/forge/Settings/Setting.js index c102a968f..a614f8874 100644 --- a/src/forge/Settings/Setting.js +++ b/src/forge/Settings/Setting.js @@ -19,23 +19,17 @@ class Setting extends Component { } componentDidUpdate=(prevPros)=>{ + console.log("dddd",this.props.checkIfLogin()); if(prevPros && this.props && !this.props.checkIfLogin()){ this.props.history.push("/403") return } } componentDidMount = () => { - // this.check_is_login() this.getCategory(); this.getLanguage(); this.getInfo(); }; - // check_is_login =() =>{ - // if(!this.props.checkIfLogin()){ - // this.props.history.push("/403") - // return - // } - // }; getLanguage = () => { const url = `/project_languages.json`; axios diff --git a/src/forge/Settings/new_tags.js b/src/forge/Settings/new_tags.js index b6727c493..cddb759d4 100644 --- a/src/forge/Settings/new_tags.js +++ b/src/forge/Settings/new_tags.js @@ -56,20 +56,13 @@ class NewTags extends Component { } } componentDidMount = () => { - // this.check_is_login(); this.getList(); }; - // check_is_login =() =>{ - // if(!this.props.checkIfLogin()){ - // this.props.history.push("/403") - // return - // } - // }; getList = (page, order_name, order_type) => { - const { projectsId } = this.props.match.params; + const { projectsId , owner } = this.props.match.params; const { limit } = this.state; - const url = `/projects/${projectsId}/issue_tags.json`; + const url = `/${owner}/${projectsId}/labels.json`; axios .get(url, { params: { @@ -94,8 +87,8 @@ class NewTags extends Component { createtagpost = () => { this.props.form.validateFieldsAndScroll((err, values) => { if (!err) { - const { projectsId } = this.props.match.params; - const url = `/projects/${projectsId}/issue_tags.json`; + const { projectsId ,owner } = this.props.match.params; + const url = `/${owner}/${projectsId}/labels.json`; axios .post(url, { ...values, @@ -178,9 +171,9 @@ class NewTags extends Component { this.updatetag(); }; updatetag = () => { - const { projectsId } = this.props.match.params; + const { projectsId ,owner } = this.props.match.params; let id = this.state.id; - const url = `/projects/${projectsId}/issue_tags/${id}.json`; + const url = `/${owner}/${projectsId}/labels/${id}.json`; let name = this.state.name; let description = this.state.description; let modalcolor = this.state.newcolor; @@ -206,8 +199,8 @@ class NewTags extends Component { }; deletetag = (id) => { - const { projectsId } = this.props.match.params; - const url = `/projects/${projectsId}/issue_tags/${id}.json`; + const { projectsId , owner } = this.props.match.params; + const url = `/${owner}/${projectsId}/labels/${id}.json`; axios .delete(url, { data: {