Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Milestone 8 : all movies counter #29

Merged
merged 5 commits into from
Mar 10, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
6 changes: 5 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ 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');
let movieCount = 0;

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

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