Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- getMovies() {
- return this.http
- .get<{ data: { id: number; attributes: Movie & { director: { data: { attributes: { name: string } } } } }[] }>(
- 'https://movie-backend.hvb.k8s.nxdevel.hu/api/movies?populate=director'
- )
- .pipe(
- map(response => {
- return response.data.map(item => ({
- id: item.id,
- title: item.attributes.title,
- releaseDate: item.attributes.releaseDate,
- description: item.attributes.description,
- createdAt: item.attributes.createdAt,
- updatedAt: item.attributes.updatedAt,
- publishedAt: item.attributes.publishedAt,
- director: item.attributes.director.data.attributes.name
- }));
- })
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement