fix: 토스판도 처음 들어오면 위치 권한을 물어 내 동네로 맞춤 (기본값 마포구에 머물던 것)

This commit is contained in:
minaChoi committed 2026-10-13 16:52:06 +09:00
1 parent 07290597a0
commit 7dcb40df78
2 files changed
+4 -5

No files matched your search

+3 -4
View File
@@ -49,10 +49,9 @@ export function RegionProvider({ children }: { children: ReactNode }) {
.catch(() => setLocateStatus('error'))
}, [setRegion])
// ask=false 는 처음 들어왔을 때: 토스에서는 권한 창을 띄우지 않고, 이미 허용한 사람만 위치로 맞춘다
const findNearest = useCallback((onFound?: () => void, ask = true) => {
const findNearest = useCallback((onFound?: () => void) => {
if (IS_TOSS) {
tossLocation(ask).then(
tossLocation(true).then(
(loc) => {
if (loc === null) setLocateStatus('idle')
else if (loc === 'denied') setLocateStatus('denied')
@@ -83,7 +82,7 @@ export function RegionProvider({ children }: { children: ReactNode }) {
// 처음 온 사람만 위치 권한을 물어 가장 가까운 구로 맞춘다
useEffect(() => {
if (!stored && canLocate) findNearest(undefined, false)
if (!stored && canLocate) findNearest()
}, [stored, canLocate, findNearest])
const api = useMemo(() => ({ region, setRegion, locate, locateStatus }), [region, setRegion, locate, locateStatus])