diff options
author | Vidhu Kant Sharma <vidhukant@vidhukant.xyz> | 2022-09-27 21:42:51 +0530 |
---|---|---|
committer | Vidhu Kant Sharma <vidhukant@vidhukant.xyz> | 2022-09-27 21:42:51 +0530 |
commit | 39819430fa47172c1a3a36218339f6baf86f8983 (patch) | |
tree | dafe65a48fcceb60b588c613e2d92be4c514633b /src/classes | |
parent | 072e53f0b2eb8fa14c0aa49286193784c73257cb (diff) |
added edit option for items and brands
Diffstat (limited to 'src/classes')
-rw-r--r-- | src/classes/brand.js | 8 | ||||
-rw-r--r-- | src/classes/item.js | 6 |
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()) +} |