From 39819430fa47172c1a3a36218339f6baf86f8983 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Tue, 27 Sep 2022 21:42:51 +0530 Subject: added edit option for items and brands --- src/classes/brand.js | 8 +++++++- src/classes/item.js | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'src/classes') 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()) +} -- cgit v1.2.3