Spaces:
Sleeping
Sleeping
| --- | |
| import MovieSection from './MovieSection.jsx'; | |
| import { getNewestMovies, getSeriesMovies, getSingleMovies, getCartoonMovies } from '../lib/api.js'; | |
| interface Props { | |
| type: 'newest' | 'series' | 'single' | 'cartoon'; | |
| title: string; | |
| href: string; | |
| } | |
| const { type, title, href } = Astro.props; | |
| let movies = []; | |
| try { | |
| if (type === 'newest') movies = (await getNewestMovies(1))?.items || []; | |
| if (type === 'series') movies = (await getSeriesMovies(1))?.items || []; | |
| if (type === 'single') movies = (await getSingleMovies(1))?.items || []; | |
| if (type === 'cartoon') movies = (await getCartoonMovies(1))?.items || []; | |
| } catch (e) { | |
| console.error(e); | |
| } | |
| --- | |
| <MovieSection title={title} movies={movies} href={href} client:load /> | |