diff --git a/app/components/GlobalError/GlobalError.js b/app/components/GlobalError/GlobalError.js index 8707296b..01458cc2 100644 --- a/app/components/GlobalError/GlobalError.js +++ b/app/components/GlobalError/GlobalError.js @@ -3,22 +3,29 @@ import PropTypes from 'prop-types' import { MdClose } from 'react-icons/lib/md' import styles from './GlobalError.scss' -const GlobalError = ({ error, clearError }) => { - setTimeout(clearError, 10000) +class GlobalError extends React.Component { + componentDidUpdate(prevProps) { + if (!prevProps.error && this.props.error) { + setTimeout(this.props.clearError, 10000) + } + } - return ( -