diff options
author | MikunoNaka <bokuwakanojogahoshii@yahoo.com> | 2021-04-30 08:38:46 +0530 |
---|---|---|
committer | MikunoNaka <bokuwakanojogahoshii@yahoo.com> | 2021-04-30 08:38:46 +0530 |
commit | 5f9cdac0d2f0522cacc092b1fcde523cddf3d97f (patch) | |
tree | cb1cd5b19658b46b9951d9d5c83e8c3aba7839ae /src/components/Form/RegisterItemForm.js | |
parent | 05dcdcc398af3ec859a750d7e514a286a265da94 (diff) |
fixed RegisterItemForm not showing/hiding
Diffstat (limited to 'src/components/Form/RegisterItemForm.js')
-rw-r--r-- | src/components/Form/RegisterItemForm.js | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/components/Form/RegisterItemForm.js b/src/components/Form/RegisterItemForm.js index ddc3eff..fe7b13d 100644 --- a/src/components/Form/RegisterItemForm.js +++ b/src/components/Form/RegisterItemForm.js @@ -17,10 +17,6 @@ import "./Form.css"; const RegisterItemForm = (props) => { - // show/hide this component - // experimental - const [visibility, setVisibility] = useState(true); - const [newItemNameValue, setNewItemNameValue] = useState(""); const [newItemDescValue, setNewItemDescValue] = useState(""); // const [newItemBrandValue, setNewItemBrandValue] = useState(""); @@ -31,16 +27,13 @@ const RegisterItemForm = (props) => { return ( - <div className={"formContainer RegisterItemFormContainer"} style={{display: visibility ? "fixed" : "none"}}> + <div className={"formContainer RegisterItemFormContainer"}> <form onSubmit={ (event) => { event.preventDefault(); - // experimental - // make sure it shows confirmation - // before hiding itself - setVisibility(false); - + // TODO: show confirmation before being invisible + props.setVisibility(false); axios.post(`/api/items/?model=${newItemNameValue}&desc=${newItemDescValue}&price=${newItemPriceValue}&hsn=${newItemHSNValue}&gst=${newItemGSTValue}`) .then((res) => { console.log(res); @@ -106,7 +99,7 @@ const RegisterItemForm = (props) => { value="cancel" onClick={ () => { - setVisibility(false); + props.setVisibility(false); } } /> |