ChandimaPrabath commited on
Commit
17406e2
1 Parent(s): 3b85fd7
frontend/src/components/HeroSection.js CHANGED
@@ -15,7 +15,7 @@ const HeroSection = () => {
15
  const fetchRecentItems = async () => {
16
  try {
17
  const response = await apiClient.getRecent();
18
- const films = response.films.map(film => ({
19
  title: film[0],
20
  description: film[2],
21
  imageUrl: film[3],
@@ -27,7 +27,7 @@ const HeroSection = () => {
27
  imageUrl: serie[3],
28
  type: 'Series'
29
  }));
30
- setItems([...films, ...series]);
31
  } catch (error) {
32
  console.error('Error fetching recent items:', error);
33
  // Handle error (e.g., set a default list or show an error message)
 
15
  const fetchRecentItems = async () => {
16
  try {
17
  const response = await apiClient.getRecent();
18
+ const movies = response.movies.map(film => ({
19
  title: film[0],
20
  description: film[2],
21
  imageUrl: film[3],
 
27
  imageUrl: serie[3],
28
  type: 'Series'
29
  }));
30
+ setItems([...movies, ...series]);
31
  } catch (error) {
32
  console.error('Error fetching recent items:', error);
33
  // Handle error (e.g., set a default list or show an error message)
frontend/src/lib/LoadBalancer.js CHANGED
@@ -14,15 +14,15 @@ class LoadBalancerAPI {
14
  }
15
 
16
  async getMovieByTitle(title) {
17
- return this._getRequest(`/api/get/film/${encodeURIComponent(title)}`);
18
  }
19
 
20
- async getTVEpisode(title, season, episode) {
21
- return this._getRequest(`/api/get/tv/${encodeURIComponent(title)}/${season}/${episode}`);
22
  }
23
 
24
- async getTVStore() {
25
- const response = await this._getRequest('/api/get/tv/store');
26
 
27
  if (response && Object.keys(response).length > 0) {
28
  this.tvCache = response; // Update cache if response is not empty
@@ -31,8 +31,8 @@ class LoadBalancerAPI {
31
  return this.tvCache || {}; // Return cache if response is empty
32
  }
33
 
34
- async getFilmStore() {
35
- const response = await this._getRequest('/api/get/film/store');
36
 
37
  if (response && Object.keys(response).length > 0) {
38
  this.filmCache = response; // Update cache if response is not empty
@@ -41,24 +41,24 @@ class LoadBalancerAPI {
41
  return this.filmCache || {}; // Return cache if response is empty
42
  }
43
 
44
- async getFilmMetadataByTitle(title) {
45
- return this._getRequest(`/api/get/film/metadata/${encodeURIComponent(title)}`);
46
  }
47
 
48
- async getTVMetadataByTitle(title) {
49
- return this._getRequest(`/api/get/tv/metadata/${encodeURIComponent(title)}`);
50
  }
51
 
52
  async getSeasonMetadataBySeriesId(seires_id, season) {
53
- return this._getRequest(`/api/get/tv/metadata/${seires_id}/${season}`);
54
  }
55
 
56
- async getAllFilms() {
57
  return this._getRequest('/api/get/film/all');
58
  }
59
 
60
- async getAllTVShows() {
61
- return this._getRequest('/api/get/tv/all');
62
  }
63
 
64
  async getRecent() {
 
14
  }
15
 
16
  async getMovieByTitle(title) {
17
+ return this._getRequest(`/api/get/movie/${encodeURIComponent(title)}`);
18
  }
19
 
20
+ async getSeriesEpisode(title, season, episode) {
21
+ return this._getRequest(`/api/get/series/${encodeURIComponent(title)}/${season}/${episode}`);
22
  }
23
 
24
+ async getSeriesStore() {
25
+ const response = await this._getRequest('/api/get/series/store');
26
 
27
  if (response && Object.keys(response).length > 0) {
28
  this.tvCache = response; // Update cache if response is not empty
 
31
  return this.tvCache || {}; // Return cache if response is empty
32
  }
33
 
34
+ async getMovieStore() {
35
+ const response = await this._getRequest('/api/get/movie/store');
36
 
37
  if (response && Object.keys(response).length > 0) {
38
  this.filmCache = response; // Update cache if response is not empty
 
41
  return this.filmCache || {}; // Return cache if response is empty
42
  }
43
 
44
+ async getMovieMetadataByTitle(title) {
45
+ return this._getRequest(`/api/get/movie/metadata/${encodeURIComponent(title)}`);
46
  }
47
 
48
+ async getSeriesMetadataByTitle(title) {
49
+ return this._getRequest(`/api/get/series/metadata/${encodeURIComponent(title)}`);
50
  }
51
 
52
  async getSeasonMetadataBySeriesId(seires_id, season) {
53
+ return this._getRequest(`/api/get/series/metadata/${seires_id}/${season}`);
54
  }
55
 
56
+ async getAllMovies() {
57
  return this._getRequest('/api/get/film/all');
58
  }
59
 
60
+ async getAllSeriesShows() {
61
+ return this._getRequest('/api/get/series/all');
62
  }
63
 
64
  async getRecent() {