aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/classes/brand.js2
-rw-r--r--src/classes/item.js9
-rw-r--r--src/components/editors/brand-editor.js1
-rw-r--r--src/components/editors/item-editor.js1
4 files changed, 4 insertions, 9 deletions
diff --git a/src/classes/brand.js b/src/classes/brand.js
index f396c6f..472798c 100644
--- a/src/classes/brand.js
+++ b/src/classes/brand.js
@@ -44,7 +44,7 @@ export const getAllBrands = (ok, fail) => {
}
export const editBrand = (brand, ok, fail) => {
- axios.put(`/brand/${brand.id}`, brand)
+ axios.put(`/brand/${brand.Id}`, brand)
.then(res => ok())
.catch(err => fail())
}
diff --git a/src/classes/item.js b/src/classes/item.js
index bfd0b7b..0486262 100644
--- a/src/classes/item.js
+++ b/src/classes/item.js
@@ -18,13 +18,6 @@
import axios from "axios";
import { Brand } from "./brand"
-/* TODO: implement a better way to handle
- * API responses/errors
- *
- * maybe I can send a notification when an item
- * is successfully added, or when some error occours
- */
-
export class Item {
constructor() {
this.Id = null;
@@ -67,7 +60,7 @@ export const getAllItems = (ok, fail) => {
}
export const editItem = (item, ok, fail) => {
- axios.put(`/item/${item.id}`, item)
+ axios.put(`/item/${item.Id}`, item)
.then(res => ok())
.catch(err => fail())
}
diff --git a/src/components/editors/brand-editor.js b/src/components/editors/brand-editor.js
index 26f4cca..64950ec 100644
--- a/src/components/editors/brand-editor.js
+++ b/src/components/editors/brand-editor.js
@@ -27,6 +27,7 @@ const BrandEditor = (props) => {
e.preventDefault();
const brand = new Brand();
+ brand.Id = props.brand.Id;
brand.Name = name;
props.editing
diff --git a/src/components/editors/item-editor.js b/src/components/editors/item-editor.js
index e2d9d94..94c6137 100644
--- a/src/components/editors/item-editor.js
+++ b/src/components/editors/item-editor.js
@@ -44,6 +44,7 @@ const ItemEditor = (props) => {
e.preventDefault();
const item = new Item();
+ item.Id = props.item.Id;
item.Name = name;
item.Description = desc;
item.HSN = HSN;