From f4f2d5cc9f20131490992941fdd58fc57ede5eb1 Mon Sep 17 00:00:00 2001 From: Mikayla Dobson Date: Tue, 8 Feb 2022 11:34:07 -0600 Subject: [PATCH] refactoring for legibility --- src/features/video/VideoPlayer.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/features/video/VideoPlayer.js b/src/features/video/VideoPlayer.js index f1928e7..0267c36 100644 --- a/src/features/video/VideoPlayer.js +++ b/src/features/video/VideoPlayer.js @@ -10,9 +10,15 @@ export default function VideoPlayer({data, src}) { const crossPostSrc = src; - let url = crossPostSrc ? crossPostSrc : // sets video source according to applicable - (data.url ? data.url : null); // location within reddit response + let url; // contains video source, routed accordingly by logic below + if (crossPostSrc) { + url = crossPostSrc; + } else if (data.url) { + url = data.url; + } else { + url = null; + } useEffect(() => { // checks the endpoint where audio may be found let checking = true; // if the fetch request throws an error, audio is set to null;