hide the serach Error when there is a success

This commit is contained in:
Jonathan Rainville 2018-10-30 20:56:59 +01:00
parent 03a32f0434
commit 5f53d6bf2e
1 changed files with 3 additions and 2 deletions

View File

@ -17,7 +17,6 @@ import {
import {explorerSearch} from "../actions"; import {explorerSearch} from "../actions";
import {LIGHT_THEME, DARK_THEME} from '../constants'; import {LIGHT_THEME, DARK_THEME} from '../constants';
import FontAwesome from 'react-fontawesome'; import FontAwesome from 'react-fontawesome';
import { } from 'reactstrap';
import "./Layout.css"; import "./Layout.css";
@ -92,6 +91,8 @@ class Layout extends React.Component {
if (nextProps.searchResult.error) { if (nextProps.searchResult.error) {
this.setState({searchError: true}); this.setState({searchError: true});
return true; return true;
} else {
this.setState({searchError: false});
} }
if (nextProps.searchResult.className) { if (nextProps.searchResult.className) {
@ -247,7 +248,7 @@ class Layout extends React.Component {
} }
<main className="main"> <main className="main">
<Alert color="danger" isOpen={this.state.searchError} toggle={() => this.dismissSearchError()}> <Alert color="danger" isOpen={(this.state.searchError && Boolean(searchResult.error))} toggle={() => this.dismissSearchError()}>
{searchResult.error} {searchResult.error}
</Alert> </Alert>