diff options
| author | real-zephex <[email protected]> | 2024-04-12 11:39:57 +0530 |
|---|---|---|
| committer | real-zephex <[email protected]> | 2024-04-12 11:39:57 +0530 |
| commit | f6ecf3a393ba50bb74ce83ad2bc723e2670f7215 (patch) | |
| tree | 676f00108119d29253ffe0b658c62575788199e4 /src/app/kdrama/components/cacher.js | |
| parent | fix: fixed kdrama page and made it available (diff) | |
| download | dramalama-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.js | 16 |
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); + } +} |