chore: add react-query

This commit is contained in:
2024-04-18 22:41:21 +02:00
parent 069a3deb7c
commit 21925d101e
7 changed files with 71 additions and 32 deletions

View File

@@ -1,3 +1,22 @@
import { useParams } from "react-router-dom";
import { useTopPodcastsQuery } from "../services/podcasts/podcast.hooks";
export function Podcast() {
const { podcastId } = useParams<{ podcastId: string }>();
const { data: podcasts } = useTopPodcastsQuery();
if (!podcastId) {
throw new Error(
"No podcast ID provided, make sure the component is rendered inside a RouterProvider",
);
}
if (!podcasts) {
return null;
}
const podcast = podcasts.find((podcast) => podcast.id === podcastId);
console.log(podcast);
return <h1>Podcast page</h1>;
}