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

export default function () {
  const [mapList, setMapList] = useState<API.MapInfo[]>([]);

  const getMapListData = useCallback((selFloorId) => {
    if (selFloorId) {
      //debugger;
      getMapList({ floorId: selFloorId, projectId: '' }).then((res) => {
        var data: API.MapInfo[] = (res.data || {}).spaceList || [];
        setMapList(data);
      });
    }
  }, []);

  return {
    mapList,
    getMapListData,
  };
}
