Add more reports
This commit is contained in:
@ -6,6 +6,7 @@ var AttendeeReducer = require('./AttendeeReducer');
|
||||
var PopularAttendeeReducer = require('./PopularAttendeeReducer');
|
||||
var SuggestionReducer = require('./SuggestionReducer');
|
||||
var PopularSuggestionReducer = require('./PopularSuggestionReducer');
|
||||
var ReportReducer = require('./ReportReducer');
|
||||
var ErrorReducer = require('./ErrorReducer');
|
||||
|
||||
module.exports = Redux.combineReducers({
|
||||
@ -15,5 +16,6 @@ module.exports = Redux.combineReducers({
|
||||
popularAttendees: PopularAttendeeReducer,
|
||||
suggestions: SuggestionReducer,
|
||||
popularSuggestions: PopularSuggestionReducer,
|
||||
reports: ReportReducer,
|
||||
error: ErrorReducer
|
||||
});
|
||||
|
19
js/reducers/ReportReducer.js
Normal file
19
js/reducers/ReportReducer.js
Normal file
@ -0,0 +1,19 @@
|
||||
var assign = require('object-assign');
|
||||
|
||||
var ReportConstants = require('../constants/ReportConstants');
|
||||
var UserConstants = require('../constants/UserConstants');
|
||||
|
||||
module.exports = function(state = {}, action) {
|
||||
switch (action.type) {
|
||||
case ReportConstants.REPORT_FETCHED:
|
||||
var report = action.report;
|
||||
var reports = assign({}, state, {
|
||||
[report.ReportId]: report
|
||||
});
|
||||
return reports;
|
||||
case UserConstants.USER_LOGGEDOUT:
|
||||
return {};
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user