Skip to content

Commit

Permalink
fix bug with missing parentisis
Browse files Browse the repository at this point in the history
  • Loading branch information
Gil Teitelbaum committed Sep 17, 2020
1 parent 9477035 commit 5475171
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/components/movies.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,16 @@ export default function Movies(props) {
if (page > 1) {
let holdMovies = movies.concat(moviesRetrieved.data.Search);
setMovies(holdMovies);
console.log("holdMovies.length=" + holdMovies.length + " " + moviesSearch.movies.length);
setMoviesSearch({ movies: [...holdMovies], totalMovies: moviesRetrieved.data.totalResults, lastPage: page, movieSearchName: movieSearchName, movieYear: movieYear })
setMoviesSearch(previousMovies => ({ ...previousMovies, movies: [...holdMovies], lastPage: page }));
}
else
else {
setMovies(moviesRetrieved.data.Search);
setMoviesSearch({ movies: moviesRetrieved.data.Search, totalMovies: moviesRetrieved.data.totalResults, lastPage: page, movieSearchName: movieSearchName, movieYear: movieYear })
setMoviesSearch({ movies: moviesRetrieved.data.Search, totalMovies: moviesRetrieved.data.totalResults, lastPage: page, movieSearchName: movieSearchName, movieYear: movieYear })
}
} catch (ex) {
setIsLoading(false);
if (ex.response && ex.response.status === 404) {
alert("not found")
alert("not found");
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/movieContext.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import React, { createContext, useState } from 'react';

export const MovieContext = createContext();
export const MovieContext = createContext([{}, () => {}]);

export const MovieProvider = (props) => {
const [moviesSearch, setMoviesSearch] = useState({});
Expand Down

0 comments on commit 5475171

Please sign in to comment.