import { getMovies } from './rest_api'; export async function renderMovies() { const moviesSection = document.querySelector('#movies'); const moviesContainer = moviesSection.querySelector('.row'); const seriesSection = document.querySelector('#series'); const seriesContainer = seriesSection.querySelector('.row'); moviesContainer.innerHTML = ''; seriesContainer.innerHTML = ''; const movies = await getMovies(); movies.forEach((movie) => { console.log(movie.id); console.log(movie.requiresSubscription); const movieTemplate = `
`; if (movie.type === 'Фильм') { moviesContainer.innerHTML += movieTemplate; } else if (movie.type === 'Сериал') { seriesContainer.innerHTML += movieTemplate; } }); } export default renderMovies;