PHP Classes

File: resources/js/store/api/all.js

Recommend this page to a friend!
  Classes of Edward Paul   Flexible PHP Coupon System   resources/js/store/api/all.js   Download  
File: resources/js/store/api/all.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Flexible PHP Coupon System
E-commerce system that supports discount coupons
Author: By
Last change:
Date: 4 years ago
Size: 2,062 bytes
 

Contents

Class file image Download
export default { getAllProducts(){ return new Promise((resolve, reject) => { axios.get('/product') .then((response) => { resolve(response) }) .catch((response) => { reject(response) }) }) }, getAllCart(){ return new Promise((resolve, reject) => { axios.get('/cart') .then((response) => { resolve(response) }) .catch((response) => { reject(response) }) }) }, addProductToCart({product, quantity}) { return new Promise((resolve, reject) => { axios.post('cart', { product_id: product.id, quantity }) .then((response) => { resolve(response) }) .catch((response) => { reject(response) }) }) }, removeProductFromCart(productId){ return new Promise((resolve, reject) => { axios.delete(`/cart/${productId}`) .then((response) => { resolve(response) }) .catch((response) => { reject(response) }) }) }, removeAllProductsFromCart(){ return new Promise((resolve, reject) => { axios.delete(`/cart`) .then((response) => { resolve(response) }) .catch((response) => { reject(response) }) }) }, applyCoupon(couponCode){ return new Promise((resolve, reject) => { axios.post('/coupon', {couponCode}) .then((response) => { resolve(response) }) .catch((response) => { reject(response) }) }) } }