From 3d257c23a86d357fcd4e19c7cd6ba95a8fdc28a6 Mon Sep 17 00:00:00 2001 From: KangBoSeok Date: Wed, 11 Dec 2024 15:07:34 +0900 Subject: [PATCH] =?UTF-8?q?feat(#75)=20:=20=EB=82=B4=20=EC=A3=BC=EB=B3=80?= =?UTF-8?q?=20=ED=81=B4=EB=A6=AD=EC=8B=9C=20=EC=B4=88=EA=B8=B0=ED=99=94,?= =?UTF-8?q?=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../placesearch/BottomSheet/BottomSheet.jsx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/components/place/placesearch/BottomSheet/BottomSheet.jsx b/src/components/place/placesearch/BottomSheet/BottomSheet.jsx index eb21bb5..ecee7da 100644 --- a/src/components/place/placesearch/BottomSheet/BottomSheet.jsx +++ b/src/components/place/placesearch/BottomSheet/BottomSheet.jsx @@ -34,12 +34,22 @@ const BottomSheet = ({ const handleLocationClick = () => { setUseCurrentLocation(true); + + if (navigator.geolocation) { + navigator.geolocation.getCurrentPosition( + (position) => { + const { latitude, longitude } = position.coords; + router.push(`/place/placemap?lat=${latitude}&lng=${longitude}`); + }, + () => alert("현재 위치를 가져올 수 없습니다.") + ); + } else { + alert("브라우저가 현재 위치 기능을 지원하지 않습니다."); + } + handleReset(); }; const handleSearch = async () => { - console.log("Selected Sido:", selectedSido); - console.log("Selected Gungu:", selectedGungu); - if (useCurrentLocation) { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(