From 6c0164e035bc9762a81ccbaade714e5193538095 Mon Sep 17 00:00:00 2001 From: MikunoNaka Date: Sun, 2 May 2021 15:17:28 +0530 Subject: added back the menu buttons on RegisterItemForm now it works --- src/components/Form/RegisterItemForm.js | 123 +++++++++++--------------------- 1 file changed, 43 insertions(+), 80 deletions(-) (limited to 'src/components/Form/RegisterItemForm.js') diff --git a/src/components/Form/RegisterItemForm.js b/src/components/Form/RegisterItemForm.js index 30d23b6..8ce2161 100644 --- a/src/components/Form/RegisterItemForm.js +++ b/src/components/Form/RegisterItemForm.js @@ -12,7 +12,7 @@ // TODO: Implement override protection import React, { useState } from "react"; -// import axios from "axios"; +import axios from "axios"; import "./Form.scss"; @@ -30,15 +30,36 @@ const RegisterItemForm = (props) => { const closeOnBGClicked = (event) => event.target.className === "floatingMenuBG" && hideSelf(); + const postForm = (event) => { + event.preventDefault(); + + // TODO: show confirmation before being invisible + 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); + }); + props.updateItemsList(); + } + + return (
-
+
-
-
-
- - -
-
-
-
-
- ); - - /* - return ( -
-
{ - event.preventDefault(); - - // TODO: show confirmation before being invisible - 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); - }); - props.updateItemsList(); - } - }> -
-
- +
-
- -
- { - props.setVisibility(false); - } - } - /> - - + +
+
- + ); - */ } export default RegisterItemForm; -- cgit v1.2.3