OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

I am facing this Promise Error in my console suddenly! Is there any problem while fetching the data from API?

  • Thread starter Thread starter Infinite Sperro787
  • Start date Start date
I

Infinite Sperro787

Guest
I am facing this error in my console and my main body page is not rendered after the shimmer!

localhost/:1 Uncaught (in promise) SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON

And my fetching code is like this:

Code:
const fetchRestaurants = async () => {
    const response = await fetch("https://allsetnow.com/api/address/v5/?sort_point=29.38385,+-94.9027&limit=100&offset=0");
    const json = await response.json();

    console.log(json);
    setListOfRestaurants(json?.data);
    setFilteredList(json?.data);

};

Is there any issue while fetching?

<p>I am facing this error in my console and my main body page is not rendered after the shimmer!</p>
<p>localhost/:1 Uncaught (in promise) SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON</p>
<p>And my fetching code is like this:</p>
<pre class="lang-js prettyprint-override"><code>const fetchRestaurants = async () => {
const response = await fetch("https://allsetnow.com/api/address/v5/?sort_point=29.38385,+-94.9027&limit=100&offset=0");
const json = await response.json();

console.log(json);
setListOfRestaurants(json?.data);
setFilteredList(json?.data);

};
</code></pre>
<p>Is there any issue while fetching?</p>
 

Online statistics

Members online
0
Guests online
4
Total visitors
4
Top