aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMikunoNaka <bokuwakanojogahoshii@yahoo.com>2021-04-30 10:33:49 +0530
committerMikunoNaka <bokuwakanojogahoshii@yahoo.com>2021-04-30 10:33:49 +0530
commitb6dfe84ecbb14da9b0c6c2d4aef4a34692e4abc3 (patch)
tree6953b15aecd3a03785df575913592d9860ebea87 /src
parent244f43e2df988e1fa267ec0760360d356d48f38f (diff)
cleaned the code and implemented shitty error handling
Diffstat (limited to 'src')
-rw-r--r--src/components/Form/RegisterItemForm.js15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/components/Form/RegisterItemForm.js b/src/components/Form/RegisterItemForm.js
index fe7b13d..864a146 100644
--- a/src/components/Form/RegisterItemForm.js
+++ b/src/components/Form/RegisterItemForm.js
@@ -19,11 +19,11 @@ import "./Form.css";
const RegisterItemForm = (props) => {
const [newItemNameValue, setNewItemNameValue] = useState("");
const [newItemDescValue, setNewItemDescValue] = useState("");
- // const [newItemBrandValue, setNewItemBrandValue] = useState("");
- // const [newItemTypeValue, setNewItemTypeValue] = useState("");
const [newItemPriceValue, setNewItemPriceValue] = useState("");
const [newItemHSNValue, setNewItemHSNValue] = useState("");
const [newItemGSTValue, setNewItemGSTValue] = useState("");
+ // const [newItemBrandValue, setNewItemBrandValue] = useState("");
+ // const [newItemTypeValue, setNewItemTypeValue] = useState("");
return (
@@ -33,10 +33,17 @@ const RegisterItemForm = (props) => {
event.preventDefault();
// TODO: show confirmation before being invisible
- props.setVisibility(false);
- axios.post(`/api/items/?model=${newItemNameValue}&desc=${newItemDescValue}&price=${newItemPriceValue}&hsn=${newItemHSNValue}&gst=${newItemGSTValue}`)
+ axios.post(
+ `/api/items/`
+ + `?model=${newItemNameValue}`
+ + `&desc=${newItemDescValue}`
+ + `&price=${newItemPriceValue}`
+ + `&hsn=${newItemHSNValue}`
+ + `&gst=${newItemGSTValue}`
+ )
.then((res) => {
console.log(res);
+ props.setVisibility(false);
})
.catch((err) => {
console.log(err);