Skip to content

Commit

Permalink
Fix: error in movie card and pass result to movie result
Browse files Browse the repository at this point in the history
  • Loading branch information
osamaakb committed Aug 23, 2020
1 parent cfdcb81 commit 002a7ac
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function App() {
/>
)}
/>
<Route path="/result" component={Result} />
<Route path="/result" render={() => <Result result={result} />} />
<Route path="/movie/:id" component={Movie} />
<Route component={Error404} />
</Switch>
Expand Down
10 changes: 2 additions & 8 deletions src/components/ResultedMovies/MovieCard.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import PropTypes from 'prop-types';
import PropTypes, { object } from 'prop-types';

export default function MovieCard({ movie }) {
return (
Expand All @@ -22,11 +22,5 @@ export default function MovieCard({ movie }) {
);
}
MovieCard.propTypes = {
movie: PropTypes.arrayOf(
PropTypes.shape({
id: PropTypes.string,
Title: PropTypes.string,
poster_path: PropTypes.string,
})
),
movie: object
};
3 changes: 1 addition & 2 deletions src/pages/ResultPage/ResultPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import MovieProjector from '../../components/MovieProjector/MovieProjector';
import MovieGrid from '../../components/ResultedMovies/MovieGrid';
import { Spin } from 'react-loading-io';
import './resultpage.css';
const ResutlPage = () => {
const ResutlPage = ({ result }) => {
useEffect(() => {
getPosters();
}, []);
Expand All @@ -14,7 +14,6 @@ const ResutlPage = () => {
const info = await fetch(url + api_key);
const result = await info.json();
setPoster(result.results);
console.log(result.results);
};
if (poster.length > 0) {
return (
Expand Down

0 comments on commit 002a7ac

Please sign in to comment.