diff options
| author | real-zephex <[email protected]> | 2024-05-11 19:14:29 +0530 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-05-11 19:14:29 +0530 |
| commit | e8875b008268c5873454b120bfb358cb4180093f (patch) | |
| tree | 2a0f8a15fb42f093e1d35f52eb3f7e14f1b0fbe5 /src/app/anime/data-fetch/request.js | |
| parent | Merge pull request #24 from zephex-alt/master (diff) | |
| parent | added anime history section (diff) | |
| download | dramalama-e8875b008268c5873454b120bfb358cb4180093f.tar.xz dramalama-e8875b008268c5873454b120bfb358cb4180093f.zip | |
Merge pull request #25 from real-zephex/improvement-2
Improvement 2
Diffstat (limited to 'src/app/anime/data-fetch/request.js')
| -rw-r--r-- | src/app/anime/data-fetch/request.js | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/app/anime/data-fetch/request.js b/src/app/anime/data-fetch/request.js new file mode 100644 index 0000000..3d22b7a --- /dev/null +++ b/src/app/anime/data-fetch/request.js @@ -0,0 +1,54 @@ +"use server"; + +import { + popular_url, + recent_epsiodes_url, + top_airing_url, + search_url, + info_url, + watch_url, +} from "../../../../utils/anime_urls"; + +export const popular = async () => { + const res = await fetch(popular_url, { next: { revalidate: 21600 } }); + const data = await res.json(); + return data; +}; + +export const recent = async () => { + const res = await fetch(recent_epsiodes_url, { + next: { revalidate: 21600 }, + }); + const data = await res.json(); + return data; +}; + +export const top_airing = async () => { + const res = await fetch(top_airing_url, { next: { revalidate: 21600 } }); + const data = await res.json(); + return data; +}; + +export const search_results = async (title) => { + const res = await fetch(search_url(title), { + next: { revalidate: 21600 }, + }); + const data = await res.json(); + return data; +}; + +export const anime_info = async (id) => { + const res = await fetch(info_url(id), { + next: { revalidate: 21600 }, + }); + const data = await res.json(); + return data; +}; + +export const video_url = async (episodeId) => { + const res = await fetch(watch_url(episodeId), { + next: { revalidate: 21600 }, + }); + const data = await res.json(); + return data; +}; |