Skip to content

Invalid api call in getPathView #11

@jjh4450

Description

@jjh4450

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 호출로 변경함

추가 컨텍스트

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions