Skip to content

Commit

Permalink
add swagger + fix client errors/warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
wassb92 committed Aug 1, 2023
1 parent 90c5fb9 commit f65997e
Show file tree
Hide file tree
Showing 7 changed files with 516 additions and 60 deletions.
4 changes: 2 additions & 2 deletions client/public/index.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>React App</title>
<title>NeoMovie - MyAllociné</title>
</head>
<body>
<div id="root"></div>
<div id="root"></div>
</body>
</html>
25 changes: 0 additions & 25 deletions client/public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,25 +0,0 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
35 changes: 23 additions & 12 deletions client/src/pages/private/Details.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,10 @@ const MovieModal = ({
<div className="flex flex-row justify-center">
{genres &&
genres.map((genre) => (
<div className="bg-gray-800 text-white rounded-full px-3 mx-1 mb-4">
<div
key={genre}
className="bg-gray-800 text-white rounded-full px-3 mx-1 mb-4"
>
{genre}
</div>
))}
Expand Down Expand Up @@ -198,20 +201,28 @@ const Details = ({
const [show, setShow] = useState(false);
const [video, setVideo] = useState();

const fetchVideo = async () => {
const url = `${global.TMDB_API}/movie/${id}/videos?api_key=${global.API_KEY}&include_video_language=fr`;
useEffect(() => {
let isMounted = true;

try {
const res = await axios.get(url);
const data = await res.data.results;
setVideo(data);
} catch (e) {
console.log(e);
}
};
const fetchVideo = async () => {
const url = `${global.TMDB_API}/movie/${id}/videos?api_key=${global.API_KEY}&include_video_language=fr`;

try {
const res = await axios.get(url);
const data = await res.data.results;
if (isMounted) {
setVideo(data);
}
} catch (e) {
console.log(e);
}
};

useEffect(() => {
fetchVideo();

return () => {
isMounted = false;
};
}, []);

const handleShow = () => setShow(true);
Expand Down
14 changes: 6 additions & 8 deletions client/src/pages/private/Popular.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ const Filter = ({ onFilterChange, handleSearch }) => {
>
{languages.map((language) => (
<option
key={language.id}
key={language.iso_639_1}
value={language.iso_639_1}
onChange={handleFilterChange}
>
Expand Down Expand Up @@ -269,13 +269,11 @@ const Popular = () => {
(movieReq) =>
movieReq.id &&
movieReq.poster_path && (
<>
<Details
key={movieReq.id}
{...movieReq}
genres={ConvertGenres(movieReq.genre_ids)}
/>
</>
<Details
key={movieReq.id}
{...movieReq}
genres={ConvertGenres(movieReq.genre_ids)}
/>
)
)}
</div>
Expand Down
55 changes: 46 additions & 9 deletions server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"jsonwebtoken": "^9.0.1",
"mongoose": "^7.4.1",
"mongoose-unique-validator": "^4.0.0",
"swagger-autogen": "^2.23.5",
"swagger-ui-express": "^5.0.0"
},
"devDependencies": {
Expand Down
Loading

0 comments on commit f65997e

Please sign in to comment.