Files
freeCodeCamp/common/app/redux/reducer.js

46 lines
1.0 KiB
JavaScript
Raw Normal View History

2016-01-27 11:34:44 -08:00
import { handleActions } from 'redux-actions';
import types from './types';
export default handleActions(
{
[types.updateTitle]: (state, { payload = 'Learn To Code' }) => ({
...state,
title: payload + ' | Free Code Camp'
}),
[types.makeToast]: (state, { payload: toast }) => ({
...state,
2016-02-04 15:03:05 -08:00
toast
2016-01-27 11:34:44 -08:00
}),
[types.setUser]: (state, { payload: user }) => ({ ...state, ...user }),
[types.challengeSaved]: (state, { payload: { points = 0 } }) => ({
...state,
points
}),
[types.updatePoints]: (state, { payload: points }) => ({
...state,
points
2016-03-05 21:06:04 -08:00
}),
[types.updateWindowHeight]: (state, { payload: windowHeight }) => ({
...state,
windowHeight
}),
[types.updateNavHeight]: (state, { payload: navHeight }) => ({
...state,
navHeight
2016-01-27 11:34:44 -08:00
})
},
{
title: 'Learn To Code | Free Code Camp',
username: null,
picture: null,
points: 0,
2016-05-09 10:13:02 -07:00
isSignedIn: false,
2016-03-05 21:06:04 -08:00
csrfToken: '',
windowHeight: 0,
navHeight: 0
2016-01-27 11:34:44 -08:00
}
);