32 lines
623 B
JavaScript
32 lines
623 B
JavaScript
import { types } from "../actions/actionTypes";
|
|
|
|
const initialState = {
|
|
subCategoryData: {},
|
|
top20ShowData: {},
|
|
productData: {},
|
|
};
|
|
|
|
export const mainReducer = (state = initialState, action) => {
|
|
switch (action.type) {
|
|
case types.GET_SUB_CATEGORY:
|
|
return {
|
|
...state,
|
|
subCategoryData: action.payload,
|
|
};
|
|
|
|
case types.GET_TOP_20_SHOW:
|
|
return {
|
|
...state,
|
|
top20ShowData: action.payload,
|
|
};
|
|
case types.GET_PRODUCT_DETAIL:
|
|
return {
|
|
...state,
|
|
productData: action.payload.product[0],
|
|
};
|
|
|
|
default:
|
|
return state;
|
|
}
|
|
};
|