mirror of
https://git.vectorsigma.ru/public/tubearchivist.git
synced 2026-08-08 10:59:28 +00:00
Refac preemptive image fallback when url is undefined. Ticket: #911
This commit is contained in:
@@ -36,6 +36,12 @@ const VideoListItem = ({
|
||||
return <p>No video found.</p>;
|
||||
}
|
||||
|
||||
let videoThumbSrc = `${getApiUrl()}${video.vid_thumb_url}`;
|
||||
|
||||
if (video.vid_thumb_url === undefined) {
|
||||
videoThumbSrc = defaultVideoThumb;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={`video-item ${viewLayout}`}>
|
||||
<a
|
||||
@@ -46,7 +52,7 @@ const VideoListItem = ({
|
||||
<div className={`video-thumb-wrap ${viewLayout}`}>
|
||||
<div className="video-thumb">
|
||||
<img
|
||||
src={`${getApiUrl()}${video.vid_thumb_url}`}
|
||||
src={videoThumbSrc}
|
||||
alt="video-thumb"
|
||||
onError={({ currentTarget }) => {
|
||||
currentTarget.onerror = null; // prevents looping
|
||||
|
||||
Reference in New Issue
Block a user