Skip to content

Commit

Permalink
watch page error cleared
Browse files Browse the repository at this point in the history
  • Loading branch information
therohantomar committed Nov 18, 2023
1 parent bd49b50 commit 7c06e02
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions src/Components/WatchPage.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { useParams } from "react-router-dom";
import useTrailer from "../utils/hooks/useTrailer";
import { TrailerInter } from "../utils/Interfaces";


const WatchPage = () => {
const { id } = useParams();
const { Trailer } = useTrailer(id);


return (
const {Trailer} = useTrailer(id) as {Trailer:TrailerInter}

<div className="realtive text-white w-full ">
if(Trailer){
return ( <div className="realtive text-white w-full ">
<iframe
className="w-full relative h-screen"
src={`https://www.youtube.com/embed/${Trailer?.key}?autoplay=1&controls=0&showinfo=0&rel=0`}
Expand All @@ -20,6 +20,10 @@ const WatchPage = () => {
<span className="absolute top-96 bg-gray-400 opacity-50 left-0 text-4xl text-black"></span>
</div>
);

}
};



export default WatchPage;
2 changes: 1 addition & 1 deletion src/utils/hooks/useTrailer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {useEffect, useState} from "react"
import { TrailerInter } from "../Interfaces";

export default function useTrailer(id:string | undefined){
const [Trailer, setTrailer] = useState<unknown | TrailerInter>({});
const [Trailer, setTrailer] = useState<TrailerInter>({id:"",name:"",key:""});


useEffect(() => {
Expand Down

0 comments on commit 7c06e02

Please sign in to comment.