Compare commits
No commits in common. "fdd3bc1f5a3fd4063e1d706a703e4685ee972266" and "bda565f8c95d67653ea8c2e7ccce8fcf413f7e28" have entirely different histories.
fdd3bc1f5a
...
bda565f8c9
1 changed files with 4 additions and 7 deletions
|
|
@ -75,12 +75,9 @@ const movieSearch = () => {
|
||||||
filteredMovies.value = sortMovies(filtered);
|
filteredMovies.value = sortMovies(filtered);
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleImageError = (_e: Event, movieId: number) => {
|
const handleImageError = (e: Event, movieId: number) => {
|
||||||
imageErrors.value = new Set(imageErrors.value).add(movieId);
|
(e.target as HTMLImageElement).src = posterPlaceholder;
|
||||||
}
|
imageErrors.value.add(movieId);
|
||||||
|
|
||||||
const getPosterSrc = (movie: Movie) => {
|
|
||||||
return imageErrors.value.has(movie.id) ? posterPlaceholder : movie.poster;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const isSortActive = (field: SortField, direction: SortDirection): boolean => {
|
const isSortActive = (field: SortField, direction: SortDirection): boolean => {
|
||||||
|
|
@ -133,7 +130,7 @@ const isSortActive = (field: SortField, direction: SortDirection): boolean => {
|
||||||
<div class="movie-poster-container">
|
<div class="movie-poster-container">
|
||||||
<NuxtImg
|
<NuxtImg
|
||||||
:class="{ 'movie-poster-error': imageErrors.has(movie.id) }"
|
:class="{ 'movie-poster-error': imageErrors.has(movie.id) }"
|
||||||
:src="getPosterSrc(movie)"
|
:src="movie.poster"
|
||||||
alt=""
|
alt=""
|
||||||
class="movie-poster"
|
class="movie-poster"
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue