/*
 * @Author: sjl
 * @Date: 2023-05-08 19:23:23
 * @Descripttion:
 */
import { defineStore } from 'pinia';
import { store } from '/@/store';
import { getResInCar } from '/@/api/resource/plat';
import { session } from '/@/utils/Memory';

interface MapState {
  sqkList: any;
}
export const useAdminStore = defineStore({
  id: 'map',
  state: (): MapState => ({
    sqkList: [],
  }),
  getters: {
    getSqkList(): any {
      return this.sqkList;
    },
  },
  actions: {

    setSqkList(list: any): void {
      this.sqkList = list;
    },

    reqCar() {
      debugger
      getResInCar({
        userId: session.getItem('userId'),
      }).then((r) => {
        if (r.datas) {
          this.setSqkList(r.datas)
        }
      })
    }
  },
});
// Need to be used outside the setup
export function useAdminStoreOut() {
  return useAdminStore(store);
}
