import { defineStore } from "pinia"
import { reactive } from 'vue'

export const repositoryListSearchStore = defineStore(
  "repositorySearch",
  () => {
    const repositorySearch = reactive({
      data: null,
    });

    // 保存
    function setRepositoryListSearchData(data) {
      repositorySearch.data = data;
    }
    
    // 清空
    function clearRepositoryListSearchData() {
      repositorySearch.data = null;
    }

    return {
      repositorySearch,
      setRepositoryListSearchData,
      clearRepositoryListSearchData,
    };
  },
  {
    unistorage: true, // 开启后对 state 的数据读写都将持久化
  },
);