Fix error dispatching

In other words, actually do it...
This commit is contained in:
2017-01-02 21:00:12 -05:00
parent 17d87a2b30
commit b4b2b20c28
3 changed files with 26 additions and 26 deletions

View File

@ -70,7 +70,7 @@ function fetchAll() {
var e = new Error();
e.fromJSON(data);
if (e.isError()) {
ErrorActions.serverError(e);
dispatch(ErrorActions.serverError(e));
} else {
dispatch(attendeesFetched(data.attendees.map(function(json) {
var a = new Attendee();
@ -80,7 +80,7 @@ function fetchAll() {
}
},
error: function(jqXHR, status, error) {
ErrorActions.ajaxError(e);
dispatch(ErrorActions.ajaxError(e));
}
});
};
@ -99,7 +99,7 @@ function create(attendee) {
var e = new Error();
e.fromJSON(data);
if (e.isError()) {
ErrorActions.serverError(e);
dispatch(ErrorActions.serverError(e));
} else {
var a = new Attendee();
a.fromJSON(data);
@ -107,7 +107,7 @@ function create(attendee) {
}
},
error: function(jqXHR, status, error) {
ErrorActions.ajaxError(e);
dispatch(ErrorActions.ajaxError(e));
}
});
};
@ -125,7 +125,7 @@ function fetchPopular() {
var e = new Error();
e.fromJSON(data);
if (e.isError()) {
ErrorActions.serverError(e);
dispatch(ErrorActions.serverError(e));
} else {
dispatch(popularAttendeesFetched(data.popularattendees.map(function(json) {
var a = new PopularAttendee();
@ -135,7 +135,7 @@ function fetchPopular() {
}
},
error: function(jqXHR, status, error) {
ErrorActions.ajaxError(e);
dispatch(ErrorActions.ajaxError(e));
}
});
};
@ -153,13 +153,13 @@ function remove(attendee) {
var e = new Error();
e.fromJSON(data);
if (e.isError()) {
ErrorActions.serverError(e);
dispatch(ErrorActions.serverError(e));
} else {
dispatch(attendeeRemoved(attendee.AttendeeId));
}
},
error: function(jqXHR, status, error) {
ErrorActions.ajaxError(e);
dispatch(ErrorActions.ajaxError(e));
}
});
};