refactor: remove Cache-Control header from movie API response; update MovieCard and HeroMovie components to manage 'seen' and 'favorite' states more effectively

This commit is contained in:
Norbert Maciaszek
2025-08-18 13:50:49 +02:00
parent 3c286e705c
commit f6ff7749ae
3 changed files with 68 additions and 52 deletions

View File

@@ -45,11 +45,17 @@ export const MovieCard: FC<Props> = ({
};
const handleSeen = () => {
updateMovieInStore(id, { seen: !movie.seen });
updateMovieInStore(id, {
seen: !movie.seen,
favorite: false,
});
};
const handleFavorite = () => {
updateMovieInStore(id, { favorite: !movie.favorite });
updateMovieInStore(id, {
favorite: !movie.favorite,
seen: movie.seen || !movie.favorite,
});
};
const releaseDate = new Date(movie.release_date);