mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-03 02:44:34 -05:00
closes #32
This commit is contained in:
@@ -16,6 +16,7 @@ export default function Manga() {
|
||||
const { id } = useParams<{id: string}>();
|
||||
|
||||
const [manga, setManga] = useState<IManga>();
|
||||
const [source, setSource] = useState<ISource>();
|
||||
const [chapters, setChapters] = useState<IChapter[]>([]);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -27,6 +28,16 @@ export default function Manga() {
|
||||
});
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (manga !== undefined) {
|
||||
client.get(`/api/v1/source/${manga.sourceId}`)
|
||||
.then((response) => response.data)
|
||||
.then((data: ISource) => {
|
||||
setSource(data);
|
||||
});
|
||||
}
|
||||
}, [manga]);
|
||||
|
||||
useEffect(() => {
|
||||
client.get(`/api/v1/manga/${id}/chapters`)
|
||||
.then((response) => response.data)
|
||||
@@ -41,7 +52,7 @@ export default function Manga() {
|
||||
|
||||
return (
|
||||
<>
|
||||
{manga && <MangaDetails manga={manga} />}
|
||||
{(manga && source) && <MangaDetails manga={manga} source={source} />}
|
||||
{chapterCards}
|
||||
</>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user