From 81a9d739f96bb3b70e2960ffdb13c0b44124d8f7 Mon Sep 17 00:00:00 2001 From: MarconLP <13001502+MarconLP@users.noreply.github.com> Date: Fri, 14 Apr 2023 15:24:15 +0200 Subject: [PATCH] only show share settings button to video author --- src/pages/share/[videoId].tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pages/share/[videoId].tsx b/src/pages/share/[videoId].tsx index 240d515..03712a2 100644 --- a/src/pages/share/[videoId].tsx +++ b/src/pages/share/[videoId].tsx @@ -8,9 +8,11 @@ import Link from "next/link"; import Image from "next/image"; import { getTime } from "~/utils/getTime"; import { ShareModal } from "~/components/ShareModal"; +import { useSession } from "next-auth/react"; const VideoList: NextPage = () => { const router = useRouter(); + const { data: session } = useSession(); const { videoId } = router.query as { videoId: string }; const { data: video, isLoading } = api.video.get.useQuery( @@ -50,7 +52,9 @@ const VideoList: NextPage = () => { Personal Library - {video ? : null} + {video && video.userId === session?.user.id ? ( + + ) : null}