diff options
| author | real-zephex <[email protected]> | 2024-05-19 08:08:57 +0530 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-05-19 08:08:57 +0530 |
| commit | a8e9ca0c14bcd6a8b2aa8cfe5b95a4e98dbcebfe (patch) | |
| tree | 98fa3f6cbdd690648c7d31a79c7d381624f38530 /src/app/web-series/components/data-fetch.js | |
| parent | minor changes to the manga page (diff) | |
| parent | added series support (diff) | |
| download | dramalama-a8e9ca0c14bcd6a8b2aa8cfe5b95a4e98dbcebfe.tar.xz dramalama-a8e9ca0c14bcd6a8b2aa8cfe5b95a4e98dbcebfe.zip | |
Merge pull request #28 from real-zephex/improvement-2
added series support
Diffstat (limited to 'src/app/web-series/components/data-fetch.js')
| -rw-r--r-- | src/app/web-series/components/data-fetch.js | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/src/app/web-series/components/data-fetch.js b/src/app/web-series/components/data-fetch.js new file mode 100644 index 0000000..e0feca5 --- /dev/null +++ b/src/app/web-series/components/data-fetch.js @@ -0,0 +1,87 @@ +"use server"; + +import { + popular_tv_shows, + trending_tv_shows, + top_rated_shows, + recommended_shows, + crew_details, + tv_info, + search_tv, +} from "../../../../utils/series_urls"; + +export const POPULAR_SHOWS = async () => { + try { + const res = await fetch(popular_tv_shows(), { + next: { + revalidate: 21600, + }, + }); + const data = await res.json(); + return data; + } catch (error) { + throw new Error(error.message); + } +}; + +export const TRENDING_SHOWS = async () => { + try { + const res = await fetch(trending_tv_shows(), { + next: { + revalidate: 21600, + }, + }); + const data = await res.json(); + return data; + } catch (error) { + throw new Error(error.message); + } +}; + +export const TOP_SHOWS = async () => { + try { + const res = await fetch(top_rated_shows(), { + next: { + revalidate: 21600, + }, + }); + const data = await res.json(); + return data; + } catch (error) { + throw new Error(error.message); + } +}; + +export const SERIES_INFO = async (id) => { + try { + const res = await fetch(tv_info(id), { next: { revalidate: 21600 } }); + const data = await res.json(); + return data; + } catch (error) { + throw new Error(error.message); + } +}; + +export const CREW_DETAILS = async (id) => { + try { + const res = await fetch(crew_details(id), { + next: { revalidate: 21600 }, + }); + const data = await res.json(); + return data; + } catch (error) { + throw new Error(error.message); + } +}; + +export const SEARCH_TV = async (title) => { + try { + const res = await fetch(search_tv(title), { + next: { revalidate: 21600 }, + }); + const data = await res.json(); + return data; + } catch (error) { + throw new Error(error.message); + } +}; |