diff options
| author | zephex-alt <[email protected]> | 2024-05-06 22:02:15 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-05-06 22:02:15 +0000 |
| commit | d58aa441e59f4f04f126c23da0864a5ff682e50a (patch) | |
| tree | f772df95c9e29df62f25bc0a16e6cad78e2fd69e /src/app/movies/components/cacher.js | |
| parent | added MOVIES support. SERIES support coming soon! (diff) | |
| download | dramalama-d58aa441e59f4f04f126c23da0864a5ff682e50a.tar.xz dramalama-d58aa441e59f4f04f126c23da0864a5ff682e50a.zip | |
minor fixes
Diffstat (limited to 'src/app/movies/components/cacher.js')
| -rw-r--r-- | src/app/movies/components/cacher.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/app/movies/components/cacher.js b/src/app/movies/components/cacher.js new file mode 100644 index 0000000..169508a --- /dev/null +++ b/src/app/movies/components/cacher.js @@ -0,0 +1,17 @@ +import { getInfoURL } from "../../../../utils/movie_urls"; + +const PreFetchMovieInfo = async (data) => { + try { + const fetchPromises = data.results.map(async (element) => { + const link = `${getInfoURL(element.id)}`; + await fetch(link, { next: { revalidate: 21600 } }); + }); + + await Promise.all(fetchPromises); + console.log("Movie info pre-fetched successfully!"); + } catch (error) { + console.error("Error occurred while pre-fetching video links:", error); + } +}; + +export default PreFetchMovieInfo; |