import { useState, useEffect, useContext } from 'react'
import CommonApi from '../../../../utils/apis/CommonApi';
import { addGeoserverLayer, addPolyline } from '../utils/helper';
import { MapContext } from '../MapContext';
import GlobalContext from '../../../../utils/GlobalContext';
export default function ZoneLayer(props) {
    const { viewer } = useContext(MapContext);
    const { zoneLayerOpt, initExtent } = useContext(GlobalContext);

    useEffect(() => {
        if (viewer) {
            addGeoserverLayer({
                ...zoneLayerOpt,
                extent: initExtent,
                viewer
            })
            CommonApi.getSubZone().then(data => {
                addPolyline({ features: data.features, viewer });
            })
        }
    }, [viewer, zoneLayerOpt, initExtent])

    return <>

    </>;
}