US States

FREEMIUM
Verified
От Aptitude Apps, LLC | Обновлено 2 месяца назад | Data
Популярность

8.6 / 10

Задержка

491ms

Уровень обслуживания

100%

Health Check

N/A

Назад ко всем обсуждениям

API Error

Rapid account: Ekoen 56
ekoen56
год назад

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);
});
};

Присоединяйтесь к обсуждению – добавьте комментарий ниже:

Войдите / Зарегистрируйтесь, чтобы публиковать новые комментарии