오픈웨더 api 관련 문제가 생겼습니다
0
// 오픈웨더 API
const weatherSearch = function(position) {
console.log(position.latitude);
const openWeatherRes = fetch(
`https://api.openweathermap.org/data/2.5/onecall?lat=${position.latitude}&lon=${position.longitude}&appid=a0fe4b649d353a27a301be4b66d4173c`
);
console.log(openWeatherRes);
// 구분
};
// 현재 위치 함수
const accessToGeo = function (position) {
const positionObj = {
latitude : position.coords.latitude,
longitude : position.coords.longitude,
};
weatherSearch(positionObj);
};
// 사용자 현재 위치
const askForLocation = function (){
navigator.geolocation.getCurrentPosition(accessToGeo, (err) =>{
console.log(err);
} );
};
;
askForLocation();
현재 코드가 이렇게 되는데 401 오류가 뜨고 있습니다
// 오픈웨더 API
const weatherSearch = function(position) {
console.log(position.latitude);
const openWeatherRes = fetch(
`https://api.openweathermap.org/data/2.5/onecall?lat=${position.latitude}&lon=${position.longitude}&appid=a0fe4b649d353a27a301be4b66d4173c`
);
console.log(openWeatherRes);
// 구분
};해당 코드에서
$ 부분이 오류가 뜨고 있기도 한데...

api는 default를 사용하였습니다
몇시간 강의 다시 보면서 뭐 잘못된 거 있나 해봐도 안 되서 이렇게 글 올려봐요

콘솔창 에러 메시지입니다
답변 1
다시 보기는 어떻게 보나요?
8
104
1
다시보기 언제부터 가능한가요?
2
118
1
문서 관리 방법이 궁금합니다.!
2
70
1
좀 정신이 없는듯 합니다.
1
71
1





