Did everything as told in the Wanderlust project, fetch doesn't work

Did everything twice but still get this error

TypeError: Failed to Fetch

Two of them. One for each fetch of the project.

This error only happened when I started working with the last 2 steps, where you render values.

const renderVenues = (venues) => {

  $venueDivs.forEach(($venue, index) => {

    // Add your code here:

    const currentDay = days[index];

    const venue = venues[index];

    const venueIcon = venue.categories[0].icon;

    const venueImgSrc = `${venueIcon.prefix}bg_64${venueIcon.suffix}`;

    let venueContent = createVenueHTML(venue.name, venue.location, venueImgSrc);

    $venue.append(venueContent);

  });

  $destination.append(`<h2>${venues[0].location.city}</h2>`);

}

const renderForecast = (day) => {

  // Add your code here:

  let weatherContent = createWeatherHTML(day);

  $weatherDiv.append(weatherContent);

}

const executeSearch = () => {

  $venueDivs.forEach(venue => venue.empty());

  $weatherDiv.empty();

  $destination.empty();

  $container.css("visibility", "visible");

  getVenues()

    .then(venues => renverVenues(venues));

  getForecast()

    .then(forecast = renderForecast(forecast));

  return false;

}

Hey Freddy! How are you doing?

Why do you need this line of code inside renderVenues():

const currentDay = days[index];

What is days? Where was it declared? Why do you need currentDay?

Also, you got a typo inside the executeSearch() function:

  getVenues()

    .then(venues => renverVenues(venues));

From the code you posted, I think this is all. Hope this helps :slight_smile:

I fixed the problems you mentioned, didn’t realise all those problems! Now it shows the getForecast values perfectly, but the venues are left in blank for some reason

Oh! Solved it, thank you for all!

1 Like