make it better

This commit is contained in:
Ray
2017-07-24 18:40:56 +01:00
commit 586fe2bec3
38 changed files with 4127 additions and 0 deletions

1
src/actions/index.js Normal file
View File

@@ -0,0 +1 @@
export * from './product';

18
src/actions/product.js Normal file
View File

@@ -0,0 +1,18 @@
import * as types from '../constants/types';
export function getProducts() {
return dispatch => {
fetch(`${process.env.REACT_APP_API_URL}/v1/api/products`)
.then(response => response.json())
.then(response => {
dispatch({
type: types.FETCH_PRODUCTS,
payload: response
});
})
}
}
export function compare(product) {
return {type: types.COMPARE_PRODUCT, product};
}