food/src/store/actions.js

18 lines
449 B
JavaScript
Raw Normal View History

2017-09-19 04:28:26 +02:00
import getProduct from '@/api';
import * as types from './mutations-types';
export default {
getProduct({ commit }, { EAN }) {
commit(types.IS_LOADING);
getProduct(EAN).then(
(result) => {
const { product } = result;
commit(types.STORE_PRODUCT, { product });
},
);
},
2017-09-20 04:11:40 +02:00
setTitle({ commit }, { title }) {
commit(types.SET_TITLE, { title });
},
2017-09-19 04:28:26 +02:00
};