Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid api call in getPathView #11

Open
Tracked by #7
jjh4450 opened this issue Dec 31, 2023 · 0 comments
Open
Tracked by #7

Invalid api call in getPathView #11

jjh4450 opened this issue Dec 31, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@jjh4450
Copy link
Member

jjh4450 commented Dec 31, 2023

Invalid api call in getPathView

useEffect(() => {
        var lat=37.8864916;
        var lng=127.7364351;
        navigator.geolocation.getCurrentPosition((pos) => {
            lat = pos.coords.latitude;
            lng = pos.coords.longitude;
        });
        let calcDistance = (p) => {
            return Math.sqrt(Math.pow(p.latitude - lat, 2) + Math.pow(p.longitude - lng, 2));
        }
        // 군집 대표 좌표 리스트 서버에서 받아오기
        axios.get('/api/report/location/union') // <------------------- 존재하지 않는 API를 호출함
          .then(res => {
            // 거리를 기준으로 정렬
            res.sort((a, b) => calcDistance(a)-calcDistance(b));
            
            setPath([
                res[0],
                res[1],
            ]);
          }).catch(error => {console.log(error);})
    }, [])

수정 사항

  • 존재하는 API 호출로 변경함

추가 컨텍스트

@jjh4450 jjh4450 added the bug Something isn't working label Dec 31, 2023
@jjh4450 jjh4450 mentioned this issue Dec 31, 2023
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant