Skip to content

Commit

Permalink
Merge branch 'main' into UTFS
Browse files Browse the repository at this point in the history
  • Loading branch information
Mooshay105 committed Feb 7, 2025
2 parents c0d40fe + 95217db commit 0a1e019
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions src/utils/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,26 +85,28 @@ async function fetchData(
}

if (shouldTrySetVideoData) {
const moviesData = formatVideoAPIData(
(await getJSONData(
`${VITE_PUBLIC_API_URL}/videoAPI/getVideoData?category=movies`,
)) || [{ id: "0" }],
);
const documentariesData = formatVideoAPIData(
(await getJSONData(
`${VITE_PUBLIC_API_URL}/videoAPI/getVideoData?category=documentaries`,
)) || [{ id: "0" }],
);
const tvshowsData = formatVideoAPIData(
(await getJSONData(
`${VITE_PUBLIC_API_URL}/videoAPI/getVideoData?category=tvshows`,
)) || [{ id: "0" }],
const videosData = formatVideoAPIData(
(await getJSONData(`${VITE_PUBLIC_API_URL}/videoAPI/getVideoData`)) || [
{ id: "0" },
],
);

const videosData = [];
videosData.push(...moviesData);
videosData.push(...documentariesData);
videosData.push(...tvshowsData);
const moviesData = [];
const documentariesData = [];
const tvshowsData = [];

for (let i = 0; i < videosData.length; i++) {
if (videosData[i].category === "movies") {
console.log("movie");
moviesData.push(videosData[i]);
} else if (videosData[i].category === "documentarys") {
console.log("documentary");
documentariesData.push(videosData[i]);
} else if (videosData[i].category === "tvshows") {
console.log("tvshow");
tvshowsData.push(videosData[i]);
}
}

setWatchlistdb(watchlistData);
setMoviesdb(moviesData);
Expand Down

0 comments on commit 0a1e019

Please sign in to comment.