diff --git a/src/views/SwipeView.vue b/src/views/SwipeView.vue index 05c80fa..65fe4ce 100644 --- a/src/views/SwipeView.vue +++ b/src/views/SwipeView.vue @@ -34,7 +34,7 @@ + @error="onImageError($event, currentUserToSwipe, photo)"> @@ -222,25 +222,33 @@ const formatGender = (gender) => { return ''; // Возвращаем пустую строку, если пол не указан, чтобы не было "Пол не указан" }; -const onImageError = (event, userOnError, photoIdOnError) => { - console.warn("Не удалось загрузить изображение:", event.target.src, "для пользователя:", userOnError.name, "фото ID:", photoIdOnError); - const userInSuggestions = suggestions.value.find(u => u._id === userOnError._id); - if (userInSuggestions && userInSuggestions.photos) { - const photoIndex = userInSuggestions.photos.findIndex(p => p._id === photoIdOnError); - if (photoIndex > -1) { - // Вместо удаления можно установить флаг ошибки или заменить URL на заглушку - // userInSuggestions.photos.splice(photoIndex, 1); - // Если просто убрать фото из массива, и оно было единственным, карусель исчезнет. - // Лучше обработать это в UI, показав заглушку для этого конкретного слайда или скрыв слайд. - // Пока просто выводим ошибку и позволяем Bootstrap обработать битую картинку (покажет alt текст). - event.target.style.display = 'none'; // Скрываем битое изображение - // Можно добавить заглушку на место битого изображения, если это один слайд из многих +const onImageError = (event, userOnError, photoWithError) => { // MODIFIED: signature and content + console.warn( + "SwipeView: Не удалось загрузить изображение.", + { + src: event.target.src, + user: userOnError.name, + photo_id: photoWithError._id, + photo_url: photoWithError.url, + event_target_attributes: { + naturalWidth: event.target.naturalWidth, + naturalHeight: event.target.naturalHeight, + complete: event.target.complete, + }, + errorEventDetails: event } - // Если после ошибки не осталось фото, показываем общую заглушку - if (!userInSuggestions.photos.some(p => p.url)) { - userInSuggestions.mainPhotoUrl = null; // Это для старой логики с одним фото, нужно будет обновить - } - } + ); + // For debugging, let's NOT hide the image for now. + // This will show the browser's default broken image icon. + // event.target.style.display = 'none'; // MODIFIED: Commented out for debugging + + // The logic to update userInSuggestions.mainPhotoUrl is outdated. + // const userInSuggestions = suggestions.value.find(u => u._id === userOnError._id); + // if (userInSuggestions && userInSuggestions.photos) { + // if (!userInSuggestions.photos.some(p => p.url)) { + // // userInSuggestions.mainPhotoUrl = null; // Outdated line + // } + // } };