Film Finder,please help i can't find the error i'm doing

Hello my name is Victor I’m studying since April the fullstack course I’m in the film finder wabapp project and I cant finish it cause I get this error.
thanks for the help!
best regards
Victor.

const tmdbKey = ''; const tmdbBaseUrl = 'https://api.themoviedb.org/3'; const playBtn = document.getElementById('playBtn'); const getGenres = async () => { const genreRequestEndpoint = '/genre/movie/list'; const requestParams = `?api_key=${tmdbKey}`; const urlToFetch = `${tmdbBaseUrl}${genreRequestEndpoint}${requestParams}`; try { const response = await fetch(urlToFetch); if(response.ok){ const jasonResponse = await response.json(); const genres = jasonResponse.genres; return genres; } } catch(error){ console.log(error); }; }; const getMovies = async () => { const selectedGenre = getSelectedGenre(); const discoverMovieEndpoint = '/discover/movie'; const requestParams = `?api_key=${tmdbKey}&with_genre=${selectedGenre}`; const urlToFetch = `${tmdbBaseUrl}${discoverMovieEndpoint}${requestParams}`; try{ const response = await fetch(urlToFetch); if (response.ok){ const jsonResponse = await response.json(); const movies = jsonResponse.results; }; }catch(error){ console.log(error); }; }; const getMovieInfo = async (movie) => { let movieId = movie.id; let movieEndpoint = "/movie/" + movieId; let requestParams = "?api_key=" + tmdbKey; let urlToFetch = tmdbBaseUrl + movieEndpoint + requestParams; try { let response = await fetch(urlToFetch); if (response.ok) { const movieInfo = await response.json(); return movieInfo; } else { // throw new Error("Request failed!"); console.log("request [for movie] failed!"); } } catch (error) { console.log(error); } }; // Gets a list of movies and ultimately displays the info of a random movie from the list const showRandomMovie = async () => { const movieInfo = document.getElementById('movieInfo'); if (movieInfo.childNodes.length > 0) { clearCurrentMovie(); } const movies = await getMovies(); const randomMovie = getRandomMovie(movies); const info = await getMovieInfo(randomMovie); displayMovie(info); }; getGenres().then(populateGenreDropdown); playBtn.onclick = showRandomMovie;

It looks like your getMovies function is missing a return.

You have
const movies = jsonResponse.results;
but you need to have
return movies;
after that.

Wow thanks! that was it!!!

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.