import { useState, useEffect } from 'react';
import { getMapList } from '@/services/ant-design-pro/environment';

let mapListData: any = [];

function useMapList(selFloorId: string) {
  const [mapList, setMapList] = useState<API.MapInfo[]>([]);

  //console.log(mapListData, 'mapListData');

  //当selFloorId 改变时调用
  useEffect(() => {
    if (selFloorId) {
      //   getMapList({ floorId: selFloorId, projectId: '' }).then((res) => {
      //     var data: API.MapInfo[] = (res.data || {}).spaceList || [];
      //     mapListData = data;
      //     setMapList(data);
      //   });
    }
  }, [selFloorId]);

  return { mapList };
}

export { useMapList, mapListData };
