Skip to content

Commit

Permalink
Add placeholder if "file" is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
martins-rafael committed Nov 19, 2020
1 parent f13e2c6 commit e4683b0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/app/services/LoadRecipeService.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ const loadService = {

const recipesPromise = recipes.map(async recipe => {
const files = await getImages(recipe.id);
recipe.image = files[0].src;

files.length != 0
? recipe.image = files[0].src
: recipe.image = 'http://placehold.it/940x280?text=Receita sem foto';
return recipe;
});
const allRecipes = Promise.all(recipesPromise);
Expand Down

0 comments on commit e4683b0

Please sign in to comment.