add loading indicator to individual video page
This commit is contained in:
parent
7546212e1e
commit
a73520552f
1 changed files with 4 additions and 1 deletions
|
|
@ -10,7 +10,7 @@ const VideoList: NextPage = () => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { videoId } = router.query as { videoId: string };
|
const { videoId } = router.query as { videoId: string };
|
||||||
|
|
||||||
const video = api.video.get.useQuery(
|
const { data: video, isFetching } = api.video.get.useQuery(
|
||||||
{ videoId },
|
{ videoId },
|
||||||
{
|
{
|
||||||
enabled: router.isReady,
|
enabled: router.isReady,
|
||||||
|
|
@ -18,6 +18,9 @@ const VideoList: NextPage = () => {
|
||||||
);
|
);
|
||||||
console.log(video);
|
console.log(video);
|
||||||
|
|
||||||
|
if (isFetching) {
|
||||||
|
return <span>loading...</span>;
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Head>
|
<Head>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue