summaryrefslogtreecommitdiff
path: root/src2/core/utils/cart.js
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2023-03-02 16:51:05 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2023-03-02 16:51:05 +0700
commitd336735a91133cc3f1cf6f67ba2ac29f0985fd2e (patch)
treef64a5c6de6e0ea015952ae028dca115077cffa45 /src2/core/utils/cart.js
parent074edfe4e51efd3b4a44dc7fe6e1284c9c560501 (diff)
delete src2
Diffstat (limited to 'src2/core/utils/cart.js')
-rw-r--r--src2/core/utils/cart.js36
1 files changed, 0 insertions, 36 deletions
diff --git a/src2/core/utils/cart.js b/src2/core/utils/cart.js
deleted file mode 100644
index 66efcbf2..00000000
--- a/src2/core/utils/cart.js
+++ /dev/null
@@ -1,36 +0,0 @@
-const getCart = () => {
- const cart = localStorage.getItem('cart');
- if (cart) return JSON.parse(cart);
- return {};
-}
-
-const setCart = (cart) => {
- localStorage.setItem('cart', JSON.stringify(cart));
- return true;
-}
-
-const getItemCart = (product_id) => {
- let cart = getCart();
- return cart[product_id];
-}
-
-const createOrUpdateItemCart = (product_id, quantity, selected = false) => {
- let cart = getCart();
- cart[product_id] = { product_id, quantity, selected };
- setCart(cart);
- return true;
-}
-
-const deleteItemCart = (product_id) => {
- let cart = getCart();
- delete cart[product_id];
- setCart(cart);
- return true;
-}
-
-export {
- getCart,
- getItemCart,
- createOrUpdateItemCart,
- deleteItemCart
-} \ No newline at end of file