aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikunoNaka <bokuwakanojogahoshii@yahoo.com>2021-05-05 10:20:41 +0530
committerMikunoNaka <bokuwakanojogahoshii@yahoo.com>2021-05-05 10:20:41 +0530
commit499c54e8eb53cf49d8ddae68528eb3a8243101d2 (patch)
treeb0227990ac10376e51423a7886c69e54efa72a29
parent4df6eaa913737427ddec2561c0ee8c9235f0c95f (diff)
fixed broken API routes and css glitch in form
-rw-r--r--server/main.go10
-rw-r--r--src/components/BillingPage.js4
-rw-r--r--src/components/Form/Form.scss4
-rw-r--r--src/components/Form/Items/AddNewItemForm.js9
-rw-r--r--src/components/Form/Items/RegisterItemForm.js6
-rw-r--r--src/components/Form/People/RegisterPersonForm.js2
6 files changed, 17 insertions, 18 deletions
diff --git a/server/main.go b/server/main.go
index 49d8c45..8b400fe 100644
--- a/server/main.go
+++ b/server/main.go
@@ -35,13 +35,13 @@ func main() {
items := api.Group("/items")
// items API routes
- items.GET("/", getAllItems)
- items.POST("/", registerItem)
+ items.GET("/get-all", getAllItems)
+ items.POST("/register", registerItem)
// people API routes
- people.GET("/", getAllPeople)
- people.POST("/", registerPerson)
+ people.GET("/get-all", getAllPeople)
+ people.POST("/register", registerPerson)
myRouter.Run(":8080")
}
@@ -75,7 +75,7 @@ func registerItem(ctx *gin.Context) {
// people API functions
func getAllPeople(ctx *gin.Context) {
- ctx.Header("Content-Type", "application/json")
+ // ctx.Header("Content-Type", "application/json")
ctx.JSON(http.StatusOK, db.GetAllPeople())
}
diff --git a/src/components/BillingPage.js b/src/components/BillingPage.js
index 73778a1..71d7c81 100644
--- a/src/components/BillingPage.js
+++ b/src/components/BillingPage.js
@@ -27,7 +27,7 @@ const BillingPage = () => {
const [registerPersonFormVisibility, setRegisterPersonFormVisibility] = useState(false);
const getRegisteredItems = () => {
- axios.get(`/api/items`)
+ axios.get(`/api/items/get-all`)
.then((res) => {
getSavedItems(res.data);
})
@@ -38,7 +38,7 @@ const BillingPage = () => {
}
const getRegisteredPeople = () => {
- axios.get(`/api/people`)
+ axios.get(`/api/people/get-all`)
.then((res) => {
getSavedPeople(res.data);
})
diff --git a/src/components/Form/Form.scss b/src/components/Form/Form.scss
index b4490a1..1ba5b85 100644
--- a/src/components/Form/Form.scss
+++ b/src/components/Form/Form.scss
@@ -72,7 +72,7 @@ input {
width: 100%;
}
-.threePaneForm div {
+.threePaneForm .formPane {
@include formPane();
}
@@ -95,7 +95,7 @@ input {
width: 100%;
}
-.twoPaneForm div {
+.twoPaneForm .formPane {
@include formPane();
}
diff --git a/src/components/Form/Items/AddNewItemForm.js b/src/components/Form/Items/AddNewItemForm.js
index 78d1437..b2099e7 100644
--- a/src/components/Form/Items/AddNewItemForm.js
+++ b/src/components/Form/Items/AddNewItemForm.js
@@ -9,7 +9,6 @@
import React, { useState } from "react";
import "./../Form.scss";
-
const AddNewItemForm = (props) => {
const [itemNameValue, setItemNameValue] = useState("");
const [itemDescValue, setItemDescValue] = useState("");
@@ -83,7 +82,7 @@ const AddNewItemForm = (props) => {
resetAllValues();
}
}>
- <div className={"widePane"}>
+ <div className={"widePane formPane"}>
<label>
Item/Service:
<select
@@ -104,7 +103,7 @@ const AddNewItemForm = (props) => {
<option key={registerItemPrompt}>{registerItemPrompt}</option>
</select>
</label>
-
+
<label>
Description:
<input className={"wideInputBox"} type="text" value={itemDescValue}
@@ -117,7 +116,7 @@ const AddNewItemForm = (props) => {
</label>
</div>
- <div className={"widePane"}>
+ <div className={"widePane formPane"}>
<label>
Quantity:
<input className={"smallInputBox"} type="number" min="1" value={itemQtyValue}
@@ -179,7 +178,7 @@ const AddNewItemForm = (props) => {
</label>
</div>
- <div className={"smallPane"}>
+ <div className={"smallPane formPane"}>
<input type="button"
value="Register New Client"
onClick={() => props.registerPersonFormVisibility(true)}
diff --git a/src/components/Form/Items/RegisterItemForm.js b/src/components/Form/Items/RegisterItemForm.js
index 140de29..b57db9f 100644
--- a/src/components/Form/Items/RegisterItemForm.js
+++ b/src/components/Form/Items/RegisterItemForm.js
@@ -35,7 +35,7 @@ const RegisterItemForm = (props) => {
// TODO: show confirmation before being invisible
axios.post(
- `/api/items/`
+ `/api/items/register/`
+ `?model=${newItemNameValue}`
+ `&desc=${newItemDescValue}`
+ `&price=${newItemPriceValue}`
@@ -59,7 +59,7 @@ const RegisterItemForm = (props) => {
<div className={"formContainer"}>
<form className={"floatingForm"} onSubmit={postForm}>
<div className={"twoPaneForm"}>
- <div className={"widePane"}>
+ <div className={"widePane formPane"}>
<label>
Item/Service: <input className={"wideInputBox"} type="text" value={newItemNameValue} onChange={
(event) => {
@@ -77,7 +77,7 @@ const RegisterItemForm = (props) => {
</label>
</div>
- <div className={"widePane"}>
+ <div className={"widePane formPane"}>
<label>
Price: <input className={"smallInputBox"} type="number" min="0.00" step="0.001" value={newItemPriceValue} onChange={
(event) => {
diff --git a/src/components/Form/People/RegisterPersonForm.js b/src/components/Form/People/RegisterPersonForm.js
index bca3bde..42cfb2e 100644
--- a/src/components/Form/People/RegisterPersonForm.js
+++ b/src/components/Form/People/RegisterPersonForm.js
@@ -30,7 +30,7 @@ const RegisterPersonForm = (props) => {
event.preventDefault();
// TODO: show confirmation before being invisible
axios.post(
- `/api/people/`
+ `/api/people/register/`
+ `?name=${newPersonName}`
+ `&phone=${newPersonPhone}`
+ `&email=${newPersonEmail}`