Add full ability to add/delete attendees
This commit is contained in:
@ -18,6 +18,10 @@ module.exports = function(state = {}, action) {
|
||||
[attendee.AttendeeId]: attendee
|
||||
});
|
||||
return attendees;
|
||||
case AttendeeConstants.ATTENDEE_REMOVED:
|
||||
var attendees = assign({}, state);
|
||||
delete attendees[action.attendeeId];
|
||||
return attendees;
|
||||
case UserConstants.USER_LOGGEDOUT:
|
||||
return {};
|
||||
default:
|
||||
|
@ -3,17 +3,17 @@ var assign = require('object-assign');
|
||||
var AttendeeConstants = require('../constants/AttendeeConstants');
|
||||
var UserConstants = require('../constants/UserConstants');
|
||||
|
||||
module.exports = function(state = {}, action) {
|
||||
module.exports = function(state = [], action) {
|
||||
switch (action.type) {
|
||||
case AttendeeConstants.POPULAR_ATTENDEES_FETCHED:
|
||||
var attendees = {};
|
||||
var attendees = [];
|
||||
for (var i = 0; i < action.attendees.length; i++) {
|
||||
var attendee = action.attendees[i];
|
||||
attendees[attendee.AttendeeId] = attendee;
|
||||
attendees.push(action.attendees[i]);
|
||||
}
|
||||
attendees.sort(function(a, b){return a.Popularity - b.Popularity});
|
||||
return attendees;
|
||||
case UserConstants.USER_LOGGEDOUT:
|
||||
return {};
|
||||
return [];
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
@ -3,17 +3,17 @@ var assign = require('object-assign');
|
||||
var SuggestionConstants = require('../constants/SuggestionConstants');
|
||||
var UserConstants = require('../constants/UserConstants');
|
||||
|
||||
module.exports = function(state = {}, action) {
|
||||
module.exports = function(state = [], action) {
|
||||
switch (action.type) {
|
||||
case SuggestionConstants.POPULAR_SUGGESTIONS_FETCHED:
|
||||
var suggestions = {};
|
||||
var suggestions = [];
|
||||
for (var i = 0; i < action.suggestions.length; i++) {
|
||||
var suggestion = action.suggestions[i];
|
||||
suggestions[suggestion.SuggestionId] = suggestion;
|
||||
suggestions.push(action.suggestions[i]);
|
||||
}
|
||||
suggestions.sort(function(a, b){return a.Popularity - b.Popularity});
|
||||
return suggestions;
|
||||
case UserConstants.USER_LOGGEDOUT:
|
||||
return {};
|
||||
return [];
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
Reference in New Issue
Block a user