Skip to content

Commit

Permalink
chore: refactor codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
Billmike committed Feb 12, 2018
1 parent 56cb52e commit dfbad32
Show file tree
Hide file tree
Showing 3 changed files with 178 additions and 281 deletions.
49 changes: 23 additions & 26 deletions client/src/components/EditRecipe.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,35 @@ import RecipesForm from './RecipesForm';
import { startEditRecipe } from '../actions/recipes';

export class EditRecipe extends Component {
onSubmit = (recipe) => {
this.props.startEditRecipe(this.props.recipe.id, recipe);
this.props.history.push('/dashboard');
};
onSubmit = recipe => {
this.props.startEditRecipe(this.props.recipe.id, recipe);
this.props.history.push('/dashboard');
};

componentWillMount() {
}
componentWillMount() {}

render() {
return (
<div>
<RecipesForm
recipe={this.props.recipe}
onSubmit={this.onSubmit}
/>
</div>
)
}
render() {
return (
<div>
<h1 className="container add-h1"> Add Recipe </h1>
<RecipesForm recipe={this.props.recipe} onSubmit={this.onSubmit} />
</div>
);
}
}

const mapStateToProps = (state, props) => {
return {
recipe: state.recipes.userRecipe.find((recipe) => {
return recipe.id == props.match.params.id;
}),
}
}
return {
recipe: state.recipes.userRecipe.find(recipe => {
return recipe.id == props.match.params.id;
})
};
};

const mapDispatchToProps = (dispatch, props) => {
return {
startEditRecipe: (id, recipe) => dispatch(startEditRecipe(id, recipe))
}
}
return {
startEditRecipe: (id, recipe) => dispatch(startEditRecipe(id, recipe))
};
};

export default connect(mapStateToProps, mapDispatchToProps)(EditRecipe);
121 changes: 0 additions & 121 deletions client/src/components/Favorite.jsx

This file was deleted.

Loading

0 comments on commit dfbad32

Please sign in to comment.