Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { GET_PRODUCTS } from 'app/main/nomenclature/store/actionTypes';
- const initialState = {
- products: [],
- isProductsPending: false
- };
- export default function (state = initialState, action) {
- const { type, payload } = action;
- switch (type) {
- case GET_PRODUCTS.PENDING:
- return {
- ...state,
- isProductsPending: true
- };
- case GET_PRODUCTS.SUCCESS:
- return {
- ...state,
- isProductsPending: false,
- products: payload
- };
- case GET_PRODUCTS.ERROR:
- return {
- ...state,
- isProductsPending: false
- };
- default: {
- return state;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment