Skip to content

Commit

Permalink
feat(#75) : 시설 페이지 URL 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
KangBoSeok-kor committed Dec 10, 2024
1 parent 9425d12 commit af015a9
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/app/place/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,22 @@ const PlacePage = () => {
}

const handleImageClick = () => {
router.push(`/place/placesearch`);
}
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(
(position) => {
const { latitude, longitude } = position.coords;
router.push(`/place/placesearch?lat=${latitude}&lng=${longitude}`); // lat, lng 값을 URL로 전달
},
() => {
alert("현재 위치를 가져올 수 없습니다.");
router.push(`/place/placesearch`); // 위치를 가져오지 못했을 경우 기본 경로로 이동
}
);
} else {
alert("Geolocation을 지원하지 않는 브라우저입니다.");
router.push(`/place/placesearch`); // Geolocation이 없을 경우 기본 경로로 이동
}
};

const handleImageClick2 = () => {
router.push(`/recommend`);
Expand Down

0 comments on commit af015a9

Please sign in to comment.