refactoring for legibility
This commit is contained in:
@@ -10,9 +10,15 @@ export default function VideoPlayer({data, src}) {
|
|||||||
|
|
||||||
const crossPostSrc = src;
|
const crossPostSrc = src;
|
||||||
|
|
||||||
let url = crossPostSrc ? crossPostSrc : // sets video source according to applicable
|
let url; // contains video source, routed accordingly by logic below
|
||||||
(data.url ? data.url : null); // location within reddit response
|
|
||||||
|
|
||||||
|
if (crossPostSrc) {
|
||||||
|
url = crossPostSrc;
|
||||||
|
} else if (data.url) {
|
||||||
|
url = data.url;
|
||||||
|
} else {
|
||||||
|
url = null;
|
||||||
|
}
|
||||||
|
|
||||||
useEffect(() => { // checks the endpoint where audio may be found
|
useEffect(() => { // checks the endpoint where audio may be found
|
||||||
let checking = true; // if the fetch request throws an error, audio is set to null;
|
let checking = true; // if the fetch request throws an error, audio is set to null;
|
||||||
|
|||||||
Reference in New Issue
Block a user