@ -6,6 +6,8 @@ const main = document.getElementById('main')
const form = document . getElementById ( 'form' )
const form = document . getElementById ( 'form' )
const search = document . getElementById ( 'search' )
const search = document . getElementById ( 'search' )
const naImg = 'https://feb.kuleuven.be/drc/LEER/visiting-scholars-1/image-not-available.jpg/image'
// Get initial movies
// Get initial movies
getMovies ( API _URL )
getMovies ( API _URL )
@ -25,8 +27,10 @@ function showMovies(movies) {
const movieEl = document . createElement ( 'div' )
const movieEl = document . createElement ( 'div' )
movieEl . classList . add ( 'movie' )
movieEl . classList . add ( 'movie' )
const imgSrc = poster _path == null ? naImg : IMG _PATH + poster _path
movieEl . innerHTML = `
movieEl . innerHTML = `
< img src = "${IMG_PATH + poster_path}" alt = "${title}" >
< img src = "${ imgSrc }" alt = "${title}" >
< div class = "movie-info" >
< div class = "movie-info" >
< h3 > $ { title } < / h 3 >
< h3 > $ { title } < / h 3 >
< span class = "${getClassByRate(vote_average)}" > $ { vote _average } < / s p a n >
< span class = "${getClassByRate(vote_average)}" > $ { vote _average } < / s p a n >