Add attendees and suggestions (except for UI)
This commit is contained in:
@ -32,6 +32,19 @@ function attendeeCreated(attendee) {
|
||||
}
|
||||
}
|
||||
|
||||
function fetchPopularAttendees() {
|
||||
return {
|
||||
type: AttendeeConstants.FETCH_POPULAR_ATTENDEES
|
||||
}
|
||||
}
|
||||
|
||||
function popularAttendeesFetched(attendees) {
|
||||
return {
|
||||
type: AttendeeConstants.POPULAR_ATTENDEES_FETCHED,
|
||||
attendees: attendees
|
||||
}
|
||||
}
|
||||
|
||||
function fetchAll() {
|
||||
return function (dispatch) {
|
||||
dispatch(fetchAttendees());
|
||||
@ -87,7 +100,36 @@ function create(attendee) {
|
||||
};
|
||||
}
|
||||
|
||||
function fetchPopular() {
|
||||
return function (dispatch) {
|
||||
dispatch(fetchPopularAttendees());
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
url: "popularattendees/",
|
||||
success: function(data, status, jqXHR) {
|
||||
var e = new Error();
|
||||
e.fromJSON(data);
|
||||
if (e.isError()) {
|
||||
ErrorActions.serverError(e);
|
||||
} else {
|
||||
dispatch(popularAttendeesFetched(data.attendees.map(function(json) {
|
||||
var a = new Attendee();
|
||||
a.fromJSON(json);
|
||||
return a;
|
||||
})));
|
||||
}
|
||||
},
|
||||
error: function(jqXHR, status, error) {
|
||||
ErrorActions.ajaxError(e);
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
fetchAll: fetchAll,
|
||||
create: create
|
||||
create: create,
|
||||
fetchPopular: fetchPopular
|
||||
};
|
||||
|
Reference in New Issue
Block a user