Skip to content

Commit

Permalink
Merge pull request #23 from bonniesimon/master
Browse files Browse the repository at this point in the history
💫Added event handling logic in PostProduct.js
  • Loading branch information
bonniesimon authored Aug 6, 2020
2 parents 3357ae2 + 3a8d074 commit 5e1f139
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/helpers/PostProducts.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,27 @@ const PostProducts = () => {
const [type, setType] = useState("")
const [unit, setUnit] = useState("")

const handleChange = (e) => {
if(e.target.name == 'name'){
setName(e.target.value);
}else if(e.target.name == 'description'){
setDescription(e.target.value);
}else if(e.target.name == 'category'){
setCategory(e.target.value);
}else if(e.target.name == 'subcategory'){
setSubcategory(e.target.value);
}else if(e.target.name == 'price'){
setPrice(e.target.value);
}else if(e.target.name == 'type'){
setType(e.target.value);
}else if(e.target.name == 'unit'){
setUnit(e.target.value);
}else{
//pass
}
}

// TODO : add @post logic

return (
<>
Expand Down

0 comments on commit 5e1f139

Please sign in to comment.