forked from Gitlink/forgeplus-react
仓库不同时调用compare接口
This commit is contained in:
parent
3e3e9f3681
commit
b6b19eabe9
|
@ -150,7 +150,7 @@ class CreateMerge extends Component {
|
|||
}else{
|
||||
if(pullOwner === mergeOwner){
|
||||
if (!noMergeBranch) {
|
||||
this.compareProject(result.data.id, branchParams);
|
||||
this.compareProject(true, branchParams);
|
||||
} else {
|
||||
this.setState({
|
||||
showMessage: true,
|
||||
|
@ -172,16 +172,14 @@ class CreateMerge extends Component {
|
|||
};
|
||||
|
||||
// compare接口,获取分支对比信息
|
||||
compareProject = (baseid, branchParams) => {
|
||||
compareProject = (sameProject, branchParams) => {
|
||||
// const { project } = this.props;
|
||||
// const { owner, projectsId } = this.props.match.params;
|
||||
const projectObj = this.props.project;
|
||||
const { pullOwner, pullBranch, mergeOwner, mergeBranch, projectId } =
|
||||
branchParams;
|
||||
|
||||
let url = `/${mergeOwner}/${projectId}/compare`;
|
||||
if (projectObj) {
|
||||
if (baseid === projectObj.id) {
|
||||
if (sameProject) {
|
||||
url += `/${pullBranch}...${mergeBranch}.json`;
|
||||
} else {
|
||||
url += `/${mergeBranch}...${pullOwner}/${projectId}:${pullBranch}.json`;
|
||||
|
@ -214,11 +212,11 @@ class CreateMerge extends Component {
|
|||
.catch((error) => {
|
||||
this.setState({ isSpin: false, isCompareSpin: false });
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// 根据所有者、仓库名,获取分支列表,目前仅涉及目标仓库分支查询
|
||||
getBranchList = ({ mergeOwner, projectId, mergeBranch }) => {
|
||||
getBranchList = (branchParams) => {
|
||||
const { mergeOwner, projectId, mergeBranch } = branchParams;
|
||||
this.setState({ isSpin: true });
|
||||
const url = `/${mergeOwner}/${projectId}/pulls/get_branches.json`;
|
||||
axios
|
||||
|
@ -234,6 +232,7 @@ class CreateMerge extends Component {
|
|||
defaultMessage: '目标分支不存在',
|
||||
isCompareSpin: false,
|
||||
});
|
||||
!noMergeBranch && this.compareProject(false, branchParams);
|
||||
}
|
||||
this.setState({ isSpin: false });
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue