Hey all I am scratching my head here. I am almost 100% certain I have written my code properly, I checked it against the help video and mine is identical. Any insight here would be much appreciated…
Here is my code…
const tmdbKey = '<myApiKeyHere>';
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 jsonResponse = response.json();
const genres = jsonResponse.genres;
return genres;
}
}
catch(error) {
console.log(error);
}
};
and here is the error I am getting…