From 70fda74d27d9b55c9030932794daa25c1e6cf50d Mon Sep 17 00:00:00 2001 From: Factiven Date: Fri, 14 Apr 2023 00:14:12 +0700 Subject: Update 6th --- pages/components/manga/chapters.js | 61 -------------------------------------- 1 file changed, 61 deletions(-) delete mode 100644 pages/components/manga/chapters.js (limited to 'pages/components/manga') 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
Chapters Not Available
; - } - // console.log(isLoading); - return ( - <> -
- {isLoading ? ( -

Loading...

- ) : data.chapters?.length > 0 ? ( - data.chapters?.map((chapter, index) => { - return ( -
- - Chapters {index + 1} - -
- ); - }) - ) : ( -

No Chapters Available

- )} -
- - ); -} -- cgit v1.2.3