Skip to content

Commit

Permalink
fixup! Update draw page to save polygon
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Stone committed Oct 19, 2022
1 parent 5bc730d commit 889da3d
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions src/app/src/components/DrawTools/useEditingPolygon.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { useEffect } from 'react';
import { useMap } from 'react-leaflet';
import { useToast } from '@chakra-ui/react';
import L from 'leaflet';
import 'leaflet-draw';
import { useDispatch, useSelector } from 'react-redux';
Expand Down Expand Up @@ -50,12 +49,11 @@ function getShapeFromDrawEvent(event) {
export default function useEditingPolygon() {
const dispatch = useDispatch();
const map = useMap();
const toast = useToast();
const id = useBoundaryId();

const { polygon, editMode, basemapType } = useSelector(state => state.map);

const [updateShape, { error }] = useUpdateBoundaryShapeMutation();
const [updateShape] = useUpdateBoundaryShapeMutation();

const updatePolygonFromDrawEvent = useTrailingDebounceCallback({
callback: event => {
Expand All @@ -76,17 +74,6 @@ export default function useEditingPolygon() {
interval: 3000,
});

useEffect(() => {
if (error) {
toast({
title: 'Error saving boundary',
status: 'error',
isClosable: true,
duration: 5000,
});
}
}, [error, toast]);

useEffect(() => {
if (polygon && polygon.visible) {
const polygonLayer = new L.Polygon(
Expand Down

0 comments on commit 889da3d

Please sign in to comment.