- Initial commit
This commit is contained in:
17
app/reducers/events.js
Normal file
17
app/reducers/events.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import { EVENTS_LOADED, GET_EVENTS } from '../constants/actionTypes.js';
|
||||
|
||||
export const events = (state = {}, action) => {
|
||||
switch (action.type) {
|
||||
case GET_EVENTS:
|
||||
return Object.assign({}, state, {
|
||||
isFetching: true,
|
||||
});
|
||||
case EVENTS_LOADED:
|
||||
return Object.assign({}, state, {
|
||||
events: action.payload,
|
||||
isFetching: false,
|
||||
});
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
19
app/reducers/index.js
Normal file
19
app/reducers/index.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import { combineReducers } from 'redux';
|
||||
|
||||
import { events } from './events.js';
|
||||
import { items } from './items.js';
|
||||
|
||||
const initialState = {
|
||||
auction: {},
|
||||
cart: [],
|
||||
isFetching: false,
|
||||
items: [],
|
||||
profile: {},
|
||||
};
|
||||
|
||||
const rootReducer = combineReducers({
|
||||
events,
|
||||
items,
|
||||
});
|
||||
|
||||
export default rootReducer;
|
||||
17
app/reducers/items.js
Normal file
17
app/reducers/items.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import { ITEMS_LOADED, GET_ITEMS } from '../constants/actionTypes.js';
|
||||
|
||||
export const items = (state = {}, action) => {
|
||||
switch (action.type) {
|
||||
case GET_ITEMS:
|
||||
return Object.assign({}, state, {
|
||||
isFetching: true,
|
||||
});
|
||||
case ITEMS_LOADED:
|
||||
return Object.assign({}, state, {
|
||||
items: action.payload,
|
||||
isFetching: false,
|
||||
});
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user