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

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

    // 保存
    function setIncidentListSearchData(data) {
      incidentListSearch.data = data;
    }
    
    // 清空
    function clearIncidentListSearchData() {
      console.log(incidentListSearch.data)
      incidentListSearch.data = null;
    }

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