p5.js-web-editor/client/modules/User/reducers.js

30 lines
902 B
JavaScript
Raw Normal View History

2016-06-23 22:29:55 +00:00
import * as ActionTypes from '../../constants';
2016-06-23 22:29:55 +00:00
const user = (state = { authenticated: false }, action) => {
switch (action.type) {
case ActionTypes.AUTH_USER:
return { ...action.user,
authenticated: true };
2016-08-28 00:46:20 +00:00
case ActionTypes.UNAUTH_USER:
return {
authenticated: false
};
2016-06-23 22:29:55 +00:00
case ActionTypes.AUTH_ERROR:
return {
authenticated: false
};
case ActionTypes.RESET_PASSWORD_INITIATE:
2016-10-18 21:06:53 +00:00
return Object.assign({}, state, { resetPasswordInitiate: true });
2016-10-14 16:08:08 +00:00
case ActionTypes.RESET_PASSWORD_RESET:
2016-10-18 21:06:53 +00:00
return Object.assign({}, state, { resetPasswordInitiate: false });
case ActionTypes.INVALID_RESET_PASSWORD_TOKEN:
return Object.assign({}, state, { resetPasswordInvalid: true });
case ActionTypes.SETTINGS_UPDATED:
return { ...state, ...action.user };
2016-06-23 22:29:55 +00:00
default:
return state;
}
};
2016-06-23 22:29:55 +00:00
export default user;