Skip to content

Commit

Permalink
fix: 최초 1번만 위치를 받아오도록 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
soulchicken committed Aug 14, 2024
1 parent 76d2734 commit bfba0b7
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/hooks/useGeoLocation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,11 @@ const useGeoLocation = () => {
maximumAge: 0,
};

const watchId = navigator.geolocation.watchPosition(
navigator.geolocation.getCurrentPosition(
handleSuccess,
handleError,
geoOptions,
);

// 컴포넌트가 언마운트될 때 위치 추적을 중지합니다.
return () => {
navigator.geolocation.clearWatch(watchId);
};
}, [setLocation, setError]);
};

Expand Down

0 comments on commit bfba0b7

Please sign in to comment.