import { useLocalStore } from 'mobx-react-lite';
import { axios } from '@choerodon/boot';
import { handlePromptError } from "../../../../../utils";
export default function useStore() {
  return useLocalStore(function () {
    return {
      cancelPipeline: function cancelPipeline(gitlabProjectId, pipelineId, id) {
        return axios.post("/devops/v1/projects/".concat(id, "/gitlab_projects/").concat(gitlabProjectId, "/pipelines/").concat(pipelineId, "/cancel")).then(function (datas) {
          return handlePromptError(datas, false);
        });
      },
      retryPipeline: function retryPipeline(gitlabProjectId, pipelineId, id) {
        return axios.post("/devops/v1/projects/".concat(id, "/gitlab_projects/").concat(gitlabProjectId, "/pipelines/").concat(pipelineId, "/retry")).then(function (datas) {
          return handlePromptError(datas, false);
        });
      },
      checkLinkToGitlab: function checkLinkToGitlab(projectId, appServiceId) {
        return axios.get("/devops/v1/projects/".concat(projectId, "/member-check/").concat(appServiceId, "?type=CICD_DETAIL"));
      }
    };
  });
}