Skip to content

Commit

Permalink
Update: Enhanced loading times (#192)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoangsonww committed May 19, 2024
1 parent 9123f39 commit d6a9939
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
8 changes: 6 additions & 2 deletions MovieVerse-Frontend/js/movie-details.js
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,8 @@ function getRatingDetails(rating) {
}

async function fetchMovieRatings(imdbId, tmdbMovieData) {
showSpinner();

const apiKeys = [
await getMovieCode2(),
'58efe859',
Expand All @@ -729,7 +731,8 @@ async function fetchMovieRatings(imdbId, tmdbMovieData) {
const response = await fetch(url);
if (!response.ok) throw new Error('API limit reached or other error');
return await response.json();
} catch (error) {
}
catch (error) {
return null;
}
}
Expand Down Expand Up @@ -772,6 +775,7 @@ async function fetchMovieRatings(imdbId, tmdbMovieData) {
}

populateMovieDetails(tmdbMovieData, imdbRating, rtRating, metascore, awards, rated);
hideSpinner();
}

function updateBrowserURL(title) {
Expand Down Expand Up @@ -1515,4 +1519,4 @@ function applyTextColor(color) {
.forEach(element => {
element.style.color = color;
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,8 @@ function getRatingDetails(rating) {
}

async function fetchMovieRatings(imdbId, tmdbMovieData) {
showSpinner();

const apiKeys = [
await getMovieCode2(),
'58efe859',
Expand All @@ -729,7 +731,8 @@ async function fetchMovieRatings(imdbId, tmdbMovieData) {
const response = await fetch(url);
if (!response.ok) throw new Error('API limit reached or other error');
return await response.json();
} catch (error) {
}
catch (error) {
return null;
}
}
Expand Down Expand Up @@ -772,6 +775,7 @@ async function fetchMovieRatings(imdbId, tmdbMovieData) {
}

populateMovieDetails(tmdbMovieData, imdbRating, rtRating, metascore, awards, rated);
hideSpinner();
}

function updateBrowserURL(title) {
Expand Down Expand Up @@ -1515,4 +1519,4 @@ function applyTextColor(color) {
.forEach(element => {
element.style.color = color;
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,8 @@ function getRatingDetails(rating) {
}

async function fetchMovieRatings(imdbId, tmdbMovieData) {
showSpinner();

const apiKeys = [
await getMovieCode2(),
'58efe859',
Expand All @@ -729,7 +731,8 @@ async function fetchMovieRatings(imdbId, tmdbMovieData) {
const response = await fetch(url);
if (!response.ok) throw new Error('API limit reached or other error');
return await response.json();
} catch (error) {
}
catch (error) {
return null;
}
}
Expand Down Expand Up @@ -772,6 +775,7 @@ async function fetchMovieRatings(imdbId, tmdbMovieData) {
}

populateMovieDetails(tmdbMovieData, imdbRating, rtRating, metascore, awards, rated);
hideSpinner();
}

function updateBrowserURL(title) {
Expand Down Expand Up @@ -1515,4 +1519,4 @@ function applyTextColor(color) {
.forEach(element => {
element.style.color = color;
});
}
}
8 changes: 6 additions & 2 deletions MovieVerse-Mobile/www/MovieVerse-Frontend/js/movie-details.js
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,8 @@ function getRatingDetails(rating) {
}

async function fetchMovieRatings(imdbId, tmdbMovieData) {
showSpinner();

const apiKeys = [
await getMovieCode2(),
'58efe859',
Expand All @@ -729,7 +731,8 @@ async function fetchMovieRatings(imdbId, tmdbMovieData) {
const response = await fetch(url);
if (!response.ok) throw new Error('API limit reached or other error');
return await response.json();
} catch (error) {
}
catch (error) {
return null;
}
}
Expand Down Expand Up @@ -772,6 +775,7 @@ async function fetchMovieRatings(imdbId, tmdbMovieData) {
}

populateMovieDetails(tmdbMovieData, imdbRating, rtRating, metascore, awards, rated);
hideSpinner();
}

function updateBrowserURL(title) {
Expand Down Expand Up @@ -1515,4 +1519,4 @@ function applyTextColor(color) {
.forEach(element => {
element.style.color = color;
});
}
}

0 comments on commit d6a9939

Please sign in to comment.