From 7e4638bab9e0a77bd9036c3c7c4782d2dde0ec2d Mon Sep 17 00:00:00 2001 From: Dovile Date: Fri, 1 Dec 2023 13:59:40 +0200 Subject: [PATCH] close popup on skip fishing --- src/components/containers/FishingLocation.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/containers/FishingLocation.tsx b/src/components/containers/FishingLocation.tsx index 2dbd238..612d204 100644 --- a/src/components/containers/FishingLocation.tsx +++ b/src/components/containers/FishingLocation.tsx @@ -32,11 +32,12 @@ const useLocationMutation = (onSuccess: (value: any) => void) => { return { getLocation, locationLoading }; }; -const useSkipMutation = () => { +const useSkipMutation = (onSuccess: () => void) => { const { isLoading: skipLoading, mutateAsync: skipFishing } = useMutation(api.skipFishing, { onError: ({ response }) => { handleAlert(response); }, + onSuccess, retry: false, }); return { skipLoading, skipFishing }; @@ -64,7 +65,7 @@ const FishingLocation = ({ setLocation, location, coordinates }: any) => { const [locationType, setLocationType] = useState(null); const { startFishing, startLoading } = useStartMutation(); - const { skipFishing, skipLoading } = useSkipMutation(); + const { skipFishing, skipLoading } = useSkipMutation(() => setShowSkipFishing(false)); const { getLocation, locationLoading } = useLocationMutation((value) => setLocation(value)); const handleSelectLocation = (type: LocationType) => () => {