diff options
| author | zephex <[email protected]> | 2024-04-20 13:34:53 +0530 |
|---|---|---|
| committer | zephex <[email protected]> | 2024-04-20 13:34:53 +0530 |
| commit | d6780cf3dad729c69a102ba2940188cf1e6bcbf4 (patch) | |
| tree | d10a2aefef6664c42439f165c73722c514b032bc /src/app/manga/cacher.js | |
| parent | feature added: tracker for mangas (diff) | |
| download | dramalama-d6780cf3dad729c69a102ba2940188cf1e6bcbf4.tar.xz dramalama-d6780cf3dad729c69a102ba2940188cf1e6bcbf4.zip | |
idk whats happening
Diffstat (limited to 'src/app/manga/cacher.js')
| -rw-r--r-- | src/app/manga/cacher.js | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/src/app/manga/cacher.js b/src/app/manga/cacher.js index 7f047ab..6059674 100644 --- a/src/app/manga/cacher.js +++ b/src/app/manga/cacher.js @@ -1,32 +1,32 @@ -// This function pre-fetches all the chapter pages links for a manga in the background -"use server"; - -export async function PreFetchChaterLinks(data) { - try { - const fetchPromises = data.map(async (element) => { - const link = `https://consumet-jade.vercel.app/meta/anilist-manga/read?chapterId=${element.id}&provider=mangadex`; - await fetch(link, { cache: "force-cache" }); - }); - - await Promise.all(fetchPromises); - console.log("Chapter links pre-fetched successfully!"); - } catch (error) { - console.error( - "Error occurred while pre-fetching chapter links:", - error - ); - } -} - -export async function PreFetchMangaInfo(data) { - try { - const fetchPromises = data.results.map(async (element) => { - const link = `https://consumet-jade.vercel.app/meta/anilist-manga/${element.id}?provider=mangadex`; - await fetch(link, { next: { revalidate: 86400 } }); - }); - await Promise.all(fetchPromises); - console.log("Manga info pre-fetched successfully!"); - } catch (error) { - console.error("error", error); - } -} +// This function pre-fetches all the chapter pages links for a manga in the background
+"use server";
+
+export async function PreFetchChaterLinks(data) {
+ try {
+ const fetchPromises = data.map(async (element) => {
+ const link = `https://consumet-jade.vercel.app/meta/anilist-manga/read?chapterId=${element.id}&provider=mangadex`;
+ await fetch(link, { cache: "force-cache" });
+ });
+
+ await Promise.all(fetchPromises);
+ console.log("Chapter links pre-fetched successfully!");
+ } catch (error) {
+ console.error(
+ "Error occurred while pre-fetching chapter links:",
+ error
+ );
+ }
+}
+
+export async function PreFetchMangaInfo(data) {
+ try {
+ const fetchPromises = data.results.map(async (element) => {
+ const link = `https://consumet-jade.vercel.app/meta/anilist-manga/${element.id}?provider=mangadex`;
+ await fetch(link, { next: { revalidate: 86400 } });
+ });
+ await Promise.all(fetchPromises);
+ console.log("Manga info pre-fetched successfully!");
+ } catch (error) {
+ console.error("error", error);
+ }
+}
|