@@ -99,24 +96,18 @@ class Movies extends Component {
);
}
- render() {
- const { isLoading, movies, totalMovies, movieSearchName, movieYear } = this.state;
-
- return (
- <>
- {isLoading &&
Loading...
}
-
- {this.state.didSearch ? this.showMovies() : null}
- {movies && movies.length > 0 && movies.length < totalMovies ?
: null}
- >
- );
- }
+ return (
+ <>
+ {isLoading &&
Loading...
}
+
+ {didSearch ? showMovies() : null}
+ {movies && movies.length > 0 && movies.length < totalMovies ?
: null}
+ >
+ );
}
-
-export default Movies;
diff --git a/src/components/moviesTable.jsx b/src/components/moviesTable.jsx
index 36401c4..35e1a29 100644
--- a/src/components/moviesTable.jsx
+++ b/src/components/moviesTable.jsx
@@ -1,27 +1,22 @@
-import React, { Component } from "react";
+import React from "react";
import { Link } from "react-router-dom";
-class MoviesTable extends Component {
- render() {
- const { movies } = this.props;
-
- return (
-
- {movies.map(movie => (
-
-
-
-
{movie.Title} {"(" + movie.Year + ")"}
-
-
- ))}
-
- );
- }
-
- setDefaultSource(event) {
+export default function MoviesTable(props) {
+ function setDefaultSource(event) {
event.target.src = "../../noimage.png";
}
-}
+ const { movies } = props;
-export default MoviesTable;
+ return (
+
+ {movies.map(movie => (
+
+
+
+
{movie.Title} {"(" + movie.Year + ")"}
+
+
+ ))}
+
+ );
+}
\ No newline at end of file
diff --git a/src/components/titleAndContent.jsx b/src/components/titleAndContent.jsx
index 84f2838..4c1c5c1 100644
--- a/src/components/titleAndContent.jsx
+++ b/src/components/titleAndContent.jsx
@@ -1,10 +1,10 @@
import React from "react";
import { Row, Col } from "react-bootstrap";
-
export default function TitleAndContent(props) {
return (
<>
+ {props.displayLine &&
}
{props.title}
diff --git a/src/services/restService.js b/src/services/restService.js
index 55ad5da..c4de1ed 100644
--- a/src/services/restService.js
+++ b/src/services/restService.js
@@ -1,10 +1,10 @@
import axios from 'axios';
import { toast } from 'react-toastify';
-import logger from "./loggerService";
+import { error } from "./loggerService";
axios.interceptors.response.use(null, error => {
if (!error.response || error.response.status < 400 || error.response.status >= 500) {
- logger.error("Error getting movies from server - " + error);
+ error("Error getting movies from server - " + error);
toast.error("an unexpected error happened");
}
return Promise.reject(error);