PHP Classes

File: resources/js/store/modules/Products.js

Recommend this page to a friend!
  Classes of Edward Paul  >  Flexible PHP Coupon System  >  resources/js/store/modules/Products.js  >  Download  
File: resources/js/store/modules/Products.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: 1 year ago
Size: 496 bytes
 

Contents

Class file image Download
import api from '../api/all'

const state = {
    products: []
};

const getters = {
    allProducts : state => {
        return state.products;
    }
};

const actions = {
    getAllProducts({commit}) {
        api.getAllProducts().then((response)=>{
            commit('setProducts', response.data.data)
        })
    }
};

const mutations = {
    setProducts(state, products){
        state.products = products
    },
};

export default {
    state,
    getters,
    mutations,
    actions
}
For more information send a message to info at phpclasses dot org.