aboutsummaryrefslogtreecommitdiff
path: root/src/app/kdrama/components/cacher.js
diff options
context:
space:
mode:
authorreal-zephex <[email protected]>2024-04-12 11:39:57 +0530
committerreal-zephex <[email protected]>2024-04-12 11:39:57 +0530
commitf6ecf3a393ba50bb74ce83ad2bc723e2670f7215 (patch)
tree676f00108119d29253ffe0b658c62575788199e4 /src/app/kdrama/components/cacher.js
parentfix: fixed kdrama page and made it available (diff)
downloaddramalama-f6ecf3a393ba50bb74ce83ad2bc723e2670f7215.tar.xz
dramalama-f6ecf3a393ba50bb74ce83ad2bc723e2670f7215.zip
minor fixes
Diffstat (limited to 'src/app/kdrama/components/cacher.js')
-rw-r--r--src/app/kdrama/components/cacher.js16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/app/kdrama/components/cacher.js b/src/app/kdrama/components/cacher.js
index 4c787d5..1bb159e 100644
--- a/src/app/kdrama/components/cacher.js
+++ b/src/app/kdrama/components/cacher.js
@@ -1,7 +1,7 @@
// This function pre-fetches all the video links for a drama in the background
"use server";
-export default async function PreFetchVideoLinks(data, dramaId) {
+export async function PreFetchVideoLinks(data, dramaId) {
try {
const fetchPromises = data.map(async (element) => {
const link = `https://consumet-jade.vercel.app/movies/dramacool/watch?episodeId=${element.id}&mediaId=${dramaId}`;
@@ -14,3 +14,17 @@ export default async function PreFetchVideoLinks(data, dramaId) {
console.error("Error occurred while pre-fetching video links:", error);
}
}
+
+export async function PreFetchAnimeInfo(data) {
+ try {
+ const fetchPromises = data.results.map(async (element) => {
+ const link = `https://consumet-jade.vercel.app/movies/dramacool/info?id=${element.id}`;
+ await fetch(link, { next: { revalidate: 86400 } });
+ });
+
+ await Promise.all(fetchPromises);
+ console.log("Drama info fetched successfully.");
+ } catch (error) {
+ console.error("Error occurred while pre-fetching video links:", error);
+ }
+}