change the way invites are assigned

assign invites directly to the state rather than by defaults in order to ensure empty objects can be part of an update
This commit is contained in:
Matthew Taylor 2017-09-08 10:24:39 -04:00
parent 7e85d2c731
commit 1dffc08445
2 changed files with 4 additions and 5 deletions

View file

@ -27,7 +27,7 @@ module.exports.getInitialState = function () {
messages: {
admin: [],
social: [],
invite: [{}]
invite: {}
}
};
};
@ -51,9 +51,8 @@ module.exports.messagesReducer = function (state, action) {
messages: {socialOffset: action.offset}
}, state);
case 'SET_SCRATCHER_INVITE':
return defaultsDeep({
messages: {invite: [action.invite]}
}, state);
state.messages.invite = action.invite;
return state;
case 'ADMIN_STATUS':
return defaultsDeep({status: {admin: action.status}}, state);
case 'MESSAGE_STATUS':

View file

@ -162,7 +162,7 @@ var mapStateToProps = function (state) {
numNewMessages: state.messageCount.messageCount,
messages: state.messages.messages.social,
adminMessages: state.messages.messages.admin,
invite: state.messages.messages.invite[0],
invite: state.messages.messages.invite,
messageOffset: state.messages.messages.socialOffset,
requestStatus: state.messages.status
};