aboutsummaryrefslogtreecommitdiff
path: root/src/classes
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-09-27 21:42:51 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-09-27 21:42:51 +0530
commit39819430fa47172c1a3a36218339f6baf86f8983 (patch)
treedafe65a48fcceb60b588c613e2d92be4c514633b /src/classes
parent072e53f0b2eb8fa14c0aa49286193784c73257cb (diff)
added edit option for items and brands
Diffstat (limited to 'src/classes')
-rw-r--r--src/classes/brand.js8
-rw-r--r--src/classes/item.js6
2 files changed, 13 insertions, 1 deletions
diff --git a/src/classes/brand.js b/src/classes/brand.js
index 967f9a1..f396c6f 100644
--- a/src/classes/brand.js
+++ b/src/classes/brand.js
@@ -43,8 +43,14 @@ export const getAllBrands = (ok, fail) => {
.catch(err => fail())
}
+export const editBrand = (brand, ok, fail) => {
+ axios.put(`/brand/${brand.id}`, brand)
+ .then(res => ok())
+ .catch(err => fail())
+}
+
export const saveBrand = (brand, ok, fail) => {
axios.post("/brand/new", brand)
.then(res => ok())
- .catch((err) => fail())
+ .catch(err => fail())
}
diff --git a/src/classes/item.js b/src/classes/item.js
index 1c59992..bfd0b7b 100644
--- a/src/classes/item.js
+++ b/src/classes/item.js
@@ -65,3 +65,9 @@ export const getAllItems = (ok, fail) => {
.then(res => ok(res.data))
.catch(err => fail())
}
+
+export const editItem = (item, ok, fail) => {
+ axios.put(`/item/${item.id}`, item)
+ .then(res => ok())
+ .catch(err => fail())
+}