27 lines
497 B
JavaScript
27 lines
497 B
JavaScript
import { handleActions } from 'redux-actions';
|
|
|
|
import types from './types';
|
|
|
|
const initialState = {
|
|
superBlocks: [],
|
|
filter: ''
|
|
};
|
|
|
|
export default handleActions(
|
|
{
|
|
[types.fetchChallengesCompleted]: (state, { payload = [] }) => ({
|
|
...state,
|
|
superBlocks: payload
|
|
}),
|
|
[types.updateFilter]: (state, { payload = ''}) => ({
|
|
...state,
|
|
filter: payload
|
|
}),
|
|
[types.clearFilter]: (state) => ({
|
|
...state,
|
|
filter: ''
|
|
})
|
|
},
|
|
initialState
|
|
);
|