Skip to content

Commit

Permalink
Merge pull request #29 from Nemwel-Boniface/countAllMovies
Browse files Browse the repository at this point in the history
Milestone 8 : all movies counter
  • Loading branch information
Nemwel-Boniface committed Mar 10, 2022
2 parents 24d8dc5 + ed12732 commit d1c605f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Let's Chill is a web application that generates random movies from the tv Maze A

## Live Demo
Live site URL to Webpack basic setup
[Live Demo Link](https://nemwel-boniface.github.io/openSourceLibrary/)
[Live Demo Link](https://happy-payne-5d37ab.netlify.app/)


## Getting Started
Expand Down
2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<a href="#"><h2>Lets Chill</h2></a>
<ul>
<li>
<a href="#">Movies<span>6</span></a>
<a href="#">Movies<span id="movieCount">6</span></a>
</li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
Expand Down
8 changes: 7 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ const involvementLikes = 'https://us-central1-involvement-api.cloudfunctions.net
const involvementComments = 'https://us-central1-involvement-api.cloudfunctions.net/capstoneApi/apps/ADIK65sjpCXvzrCJe3B4/comments/';
const movieWrapper = document.querySelector('.image-container');
const commentWraper = document.querySelector('.comment-main-container');
const movieCount = [];

const countAllMovies = () => movieCount.length;

const testMovie = async (baseMovieURL) => {
for (let i = 20; i < 29; i += 1) {
for (let i = 20; i < 30; i += 1) {
movieCount.push(i);
fetch(baseMovieURL + i)
.then((response) => response.json())
.then((result) => {
Expand Down Expand Up @@ -167,6 +171,8 @@ const testMovie = async (baseMovieURL) => {
movieWrapper.appendChild(movie);
});
}
const movieCounter = document.getElementById('movieCount');
movieCounter.innerHTML = countAllMovies();
};

document.addEventListener('DOMContentLoaded', () => {
Expand Down
8 changes: 4 additions & 4 deletions src/modules/toInvolvementAPI.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const addToInvolvement = async (involvementLikes, index, clicked) => {
await fetch(involvementLikes, {
const addToInvolvement = (involvementLikes, index, clicked) => {
fetch(involvementLikes, {
method: 'POST',
headers: {
'Content-type': 'application/json; charset=UTF-8',
Expand All @@ -12,13 +12,13 @@ const addToInvolvement = async (involvementLikes, index, clicked) => {
.then((response) => response.text());
};

const addCommentToInvolvement = async (
const addCommentToInvolvement = (
involvementComments,
index,
username,
comment,
) => {
await fetch(involvementComments, {
fetch(involvementComments, {
method: 'POST',
headers: {
'Content-type': 'application/json; charset=UTF-8',
Expand Down

0 comments on commit d1c605f

Please sign in to comment.