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

      get getSelectedMenu() {
        return this.selectedMenu;
      },

      expandedKeys: ['group-null'],
      setExpandedKeys: function setExpandedKeys(keys) {
        this.expandedKeys = keys;
      },

      get getExpandedKeys() {
        return this.expandedKeys.slice();
      },

      searchValue: '',
      setSearchValue: function setSearchValue(value) {
        this.searchValue = value;
      },

      get getSearchValue() {
        return this.searchValue;
      },

      deleteGroup: function deleteGroup(projectId, groupId) {
        return axios["delete"]("/devops/v1/projects/".concat(projectId, "/env_groups/").concat(groupId));
      },
      upTarget: null,
      setUpTarget: function setUpTarget(data) {
        this.upTarget = data;
      },

      get getUpTarget() {
        return this.upTarget;
      }

    };
  });
}