Skip to content

Commit

Permalink
finish
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikolaus-B committed Nov 10, 2023
1 parent 9d8b174 commit 5bf5c28
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/components/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,12 @@ export class App extends Component {

const newImages = await fetchImages(clearQuery, this.state.page);

this.setState(prevState => ({
images: [...prevState.images, ...newImages],
}));
if (this.state.images) {
toast.error('Non-existing search query');
if (newImages.length === 0) {
toast.error('No more images available');
} else {
this.setState(prevState => ({
images: [...prevState.images, ...newImages],
}));
}
} catch (err) {
this.setState({ error: true });
Expand Down

0 comments on commit 5bf5c28

Please sign in to comment.