import { useLocalStore } from 'mobx-react-lite';
import { axios } from '@choerodon/boot';
export default function useStore() {
  return useLocalStore(function () {
    return {
      branchPrefix: '',
      setBranchPrefix: function setBranchPrefix(data) {
        this.branchPrefix = data;
      },

      get getBranchPrefix() {
        return this.branchPrefix;
      },

      /**
       * 加载分支数据
       */
      loadBranchData: function loadBranchData(projectId, appServiceId, branchPageSize) {
        var text = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
        var postData = {
          searchParam: {
            branchName: text
          },
          param: []
        };
        return axios.post("devops/v1/projects/".concat(projectId, "/app_service/").concat(appServiceId, "/git/page_branch_by_options?page=1&size=").concat(branchPageSize), postData);
      },

      /**
       * 加载标记数据
       */
      loadTagData: function loadTagData(projectId, appServiceId, tagPageSize) {
        var text = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
        var postData = {
          searchParam: {
            tagName: text
          },
          param: []
        };
        return axios.post("devops/v1/projects/".concat(projectId, "/app_service/").concat(appServiceId, "/git/page_tags_by_options?page=1&size=").concat(tagPageSize), postData);
      }
    };
  });
}