diff options
| author | Factiven <[email protected]> | 2023-04-14 00:14:12 +0700 |
|---|---|---|
| committer | Factiven <[email protected]> | 2023-04-14 00:14:12 +0700 |
| commit | 70fda74d27d9b55c9030932794daa25c1e6cf50d (patch) | |
| tree | 0c1f639be4e8ec1b960ba642b8e99c1485e83b1a /pages/components/manga | |
| parent | Update 5th (diff) | |
| download | moopa-70fda74d27d9b55c9030932794daa25c1e6cf50d.tar.xz moopa-70fda74d27d9b55c9030932794daa25c1e6cf50d.zip | |
Update 6th
Diffstat (limited to 'pages/components/manga')
| -rw-r--r-- | pages/components/manga/chapters.js | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/pages/components/manga/chapters.js b/pages/components/manga/chapters.js deleted file mode 100644 index 7997a73..0000000 --- a/pages/components/manga/chapters.js +++ /dev/null @@ -1,61 +0,0 @@ -import axios from "axios"; -import Link from "next/link"; -import React, { useEffect, useState } from "react"; - -export default function Content({ ids, providers }) { - const [data, setData] = useState([]); - const [isLoading, setIsLoading] = useState(true); - const [error, setError] = useState(null); - - async function fetchData() { - setIsLoading(true); - try { - const res = await axios.get( - `https://api.eucrypt.my.id/meta/anilist-manga/info/${ids}?provider=${providers}` - ); - const data = res.data; - setData(data); - setError(null); // Reset error state if data is successfully fetched - } catch (error) { - setError(error); - } - - setIsLoading(false); - } - useEffect(() => { - fetchData(); - }, [providers]); - useEffect(() => { - // console.log("Data changed:", data); - }, [data]); - - if (error) { - // Handle 404 Not Found error - return <div>Chapters Not Available</div>; - } - // console.log(isLoading); - return ( - <> - <div className="flex h-[540px] flex-col gap-5 overflow-y-scroll"> - {isLoading ? ( - <p>Loading...</p> - ) : data.chapters?.length > 0 ? ( - data.chapters?.map((chapter, index) => { - return ( - <div key={index}> - <Link - href={`/manga/chapter/[chapter]`} - as={`/manga/chapter/read?id=${chapter.id}&provider=${providers}`} - > - Chapters {index + 1} - </Link> - </div> - ); - }) - ) : ( - <p>No Chapters Available</p> - )} - </div> - </> - ); -} |