import { useEffect } from "react"; import ChapterSelector from "./chapters"; import axios from "axios"; import pls from "@/utils/request"; export default function ChaptersComponent({ info, mangaId, aniId, setWatch, chapter, setChapter, loading, setLoading, notFound, setNotFound, }) { useEffect(() => { setLoading(true); }, [aniId]); useEffect(() => { async function fetchData() { try { setLoading(true); // console.log(mangaId); if (mangaId) { const Chapters = await pls.get( `https://api.anify.tv/chapters/${mangaId}` ); // console.log("clean this balls"); if (!Chapters) { setLoading(false); setNotFound(true); } else { setChapter(Chapters); setLoading(false); } } } catch (error) { console.error(error); } finally { setLoading(false); } } fetchData(); }, [mangaId]); return (
{!loading ? ( notFound ? (

Oops!

It looks like this manga is not available.

) : info && chapter && chapter.length > 0 ? ( ) : (
) ) : (
)}
); }