1234567891011121314151617181920212223242526272829303132333435363738394041 |
- const state = {
- products: []
- }
- const getters = {
- getProducts (state) {
- return state.products
- }
- }
- const mutations = {
- pushProducts(state, payload) {
- state.products = [...payload.products]
- }
- }
- const actions = {
- fetchProducts ({ commit }) {
- let pos = new openerp.web.Model('eiru.pos')
- pos.call('get_products').then(response => {
- commit('pushProducts', {
- products: response
- })
- }).fail(error => {
- console.log(error)
- })
- },
- // selectProduct({ dispatch }, payload) {
- // // dispatch('addToCart', payload)
- // }
- selectProduct(args) {
- console.log(args)
- }
- }
- export default {
- state,
- getters,
- mutations,
- actions
- }
|