food/src/store/actions.js

18 lines
501 B
JavaScript

import getProduct from '@/api';
import * as types from './mutations-types';
export default {
getProduct({ commit }, { EAN }) {
commit(types.IS_LOADING);
getProduct(EAN).then(
product => commit(types.STORE_PRODUCT, { product }),
);
},
setTitle({ commit }, { title }) {
commit(types.SET_TITLE, { title });
},
setBackgroundColor({ commit }, { backgroundColor }) {
commit(types.SET_BACKGROUND_COLOR, { backgroundColor });
},
};