US States

부분 유료
Verified
분류별 Aptitude Apps, LLC | 업데이트됨 2 mesi fa | Data
인기

8.6 / 10

지연 시간

491ms

서비스 수준

100%

Health Check

N/A

모든 토론으로 돌아가기

API Error

Rapid account: Ekoen 56
ekoen56
un anno fa

I am getting an error and I don’t know what it means. I haven’t changed anything in the code segment that fetches data from the API and stores it.

This is the error: Error: “Unexpected token ‘O’, “Oops, an e”… is not valid JSON” in SyntaxError: Unexpected token ‘O’, “Oops, an e”… is not valid JSON"

Here’s the code:

const options = {
method: ‘GET’,
headers: {
‘X-RapidAPI-Key’: ‘0c7e651446msh9d309a885c79429p1421dejsna49fa790aca8’,
‘X-RapidAPI-Host’: ‘us-states.p.rapidapi.com’,
},
};
componentDidMount = () => {
return fetch(‘https://us-states.p.rapidapi.com/all’, options)
.then((response) => response.json())
.then((response) => {
console.log(response);
this.setState({
isLoading: false,
dataSource: response,
});
})
.catch((error) => {
console.log(error);
});
};

아래에 의견을 추가하고 토론에 참여하세요.

새 댓글을 게시하려면 로그인 / 가입