From b4b2b20c28ae628dcf455823a28f419e595169c0 Mon Sep 17 00:00:00 2001 From: Aaron Lindsay Date: Mon, 2 Jan 2017 21:00:12 -0500 Subject: [PATCH] Fix error dispatching In other words, actually do it... --- js/actions/AttendeeActions.js | 16 ++++++++-------- js/actions/SuggestionActions.js | 16 ++++++++-------- js/actions/UserActions.js | 20 ++++++++++---------- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/js/actions/AttendeeActions.js b/js/actions/AttendeeActions.js index 0f2e729..7d0a823 100644 --- a/js/actions/AttendeeActions.js +++ b/js/actions/AttendeeActions.js @@ -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)); } }); }; diff --git a/js/actions/SuggestionActions.js b/js/actions/SuggestionActions.js index ab2b656..3f88b21 100644 --- a/js/actions/SuggestionActions.js +++ b/js/actions/SuggestionActions.js @@ -71,7 +71,7 @@ function fetchAll() { var e = new Error(); e.fromJSON(data); if (e.isError()) { - ErrorActions.serverError(e); + dispatch(ErrorActions.serverError(e)); } else { dispatch(suggestionsFetched(data.suggestions.map(function(json) { var a = new Suggestion(); @@ -81,7 +81,7 @@ function fetchAll() { } }, error: function(jqXHR, status, error) { - ErrorActions.ajaxError(e); + dispatch(ErrorActions.ajaxError(e)); } }); }; @@ -100,7 +100,7 @@ function create(suggestion) { var e = new Error(); e.fromJSON(data); if (e.isError()) { - ErrorActions.serverError(e); + dispatch(ErrorActions.serverError(e)); } else { var a = new Suggestion(); a.fromJSON(data); @@ -108,7 +108,7 @@ function create(suggestion) { } }, error: function(jqXHR, status, error) { - ErrorActions.ajaxError(e); + dispatch(ErrorActions.ajaxError(e)); } }); }; @@ -126,7 +126,7 @@ function fetchPopular() { var e = new Error(); e.fromJSON(data); if (e.isError()) { - ErrorActions.serverError(e); + dispatch(ErrorActions.serverError(e)); } else { dispatch(popularSuggestionsFetched(data.popularsuggestions.map(function(json) { var a = new PopularSuggestion(); @@ -136,7 +136,7 @@ function fetchPopular() { } }, error: function(jqXHR, status, error) { - ErrorActions.ajaxError(e); + dispatch(ErrorActions.ajaxError(e)); } }); }; @@ -154,13 +154,13 @@ function remove(suggestion) { var e = new Error(); e.fromJSON(data); if (e.isError()) { - ErrorActions.serverError(e); + dispatch(ErrorActions.serverError(e)); } else { dispatch(suggestionRemoved(suggestion.SuggestionId)); } }, error: function(jqXHR, status, error) { - ErrorActions.ajaxError(e); + dispatch(ErrorActions.ajaxError(e)); } }); }; diff --git a/js/actions/UserActions.js b/js/actions/UserActions.js index eb16863..e7d9f6e 100644 --- a/js/actions/UserActions.js +++ b/js/actions/UserActions.js @@ -74,7 +74,7 @@ function fetch(userId) { var e = new Error(); e.fromJSON(data); if (e.isError()) { - ErrorActions.serverError(e); + dispatch(ErrorActions.serverError(e)); } else { var u = new User(); u.fromJSON(data); @@ -82,7 +82,7 @@ function fetch(userId) { } }, error: function(jqXHR, status, error) { - ErrorActions.ajaxError(e); + dispatch(ErrorActions.ajaxError(e)); } }); }; @@ -110,7 +110,7 @@ function login(user) { var e = new Error(); e.fromJSON(data); if (e.isError()) { - ErrorActions.serverError(e); + dispatch(ErrorActions.serverError(e)); } else { var s = new Session(); s.fromJSON(data); @@ -118,7 +118,7 @@ function login(user) { } }, error: function(jqXHR, status, error) { - ErrorActions.ajaxError(e); + dispatch(ErrorActions.ajaxError(e)); } }); }; @@ -135,7 +135,7 @@ function tryResumingSession() { e.fromJSON(data); if (e.isError()) { if (e.ErrorId != 1 /* Not Signed In*/) - ErrorActions.serverError(e); + dispatch(ErrorActions.serverError(e)); } else { var s = new Session(); s.fromJSON(data); @@ -144,7 +144,7 @@ function tryResumingSession() { } }, error: function(jqXHR, status, error) { - ErrorActions.ajaxError(e); + dispatch(ErrorActions.ajaxError(e)); } }); }; @@ -162,13 +162,13 @@ function logout() { var e = new Error(); e.fromJSON(data); if (e.isError()) { - ErrorActions.serverError(e); + dispatch(ErrorActions.serverError(e)); } else { dispatch(userLoggedOut()); } }, error: function(jqXHR, status, error) { - ErrorActions.ajaxError(e); + dispatch(ErrorActions.ajaxError(e)); } }); }; @@ -187,7 +187,7 @@ function update(user) { var e = new Error(); e.fromJSON(data); if (e.isError()) { - ErrorActions.serverError(e); + dispatch(ErrorActions.serverError(e)); } else { var u = new User(); u.fromJSON(data); @@ -195,7 +195,7 @@ function update(user) { } }, error: function(jqXHR, status, error) { - ErrorActions.ajaxError(e); + dispatch(ErrorActions.ajaxError(e)); } }); };