aboutsummaryrefslogtreecommitdiff
path: root/src/web/js/actions
diff options
context:
space:
mode:
Diffstat (limited to 'src/web/js/actions')
-rw-r--r--src/web/js/actions/MenuActions.js2
-rw-r--r--src/web/js/actions/MiddlePanelActions.js17
2 files changed, 8 insertions, 11 deletions
diff --git a/src/web/js/actions/MenuActions.js b/src/web/js/actions/MenuActions.js
index 4266c207..4b17d084 100644
--- a/src/web/js/actions/MenuActions.js
+++ b/src/web/js/actions/MenuActions.js
@@ -9,8 +9,8 @@ var MenuActions = {
jquery.getJSON('/menu', function(payload) {
JarrDispatcher.dispatch({
type: ActionTypes.RELOAD_MENU,
+ feeds: payload.feeds,
categories: payload.categories,
- feed_in_error: payload.feed_in_error,
all_unread_count: payload.all_unread_count,
});
});
diff --git a/src/web/js/actions/MiddlePanelActions.js b/src/web/js/actions/MiddlePanelActions.js
index e1ced2a2..ec76d2bc 100644
--- a/src/web/js/actions/MiddlePanelActions.js
+++ b/src/web/js/actions/MiddlePanelActions.js
@@ -21,14 +21,16 @@ var shouldFetch = function(filters) {
// }
// return false;
}
+var key_whitelist = ['filter_id', 'filter_type',
+ 'query', 'search_title', 'search_content'];
var reloadIfNecessaryAndDispatch = function(dispath_payload) {
if(shouldFetch(dispath_payload)) {
var filters = MiddlePanelStore.getRequestFilter();
- for (var key in filters) {
- if(dispath_payload[key] != null) {
+ key_whitelist.map(function(key) {
+ if(key in dispath_payload) {
filters[key] = dispath_payload[key];
}
- }
+ });
jquery.getJSON('/middle_panel', filters,
function(payload) {
dispath_payload.articles = payload.articles;
@@ -43,13 +45,8 @@ var reloadIfNecessaryAndDispatch = function(dispath_payload) {
var MiddlePanelActions = {
reload: function() {
- var filters = MiddlePanelStore.getRequestFilter();
- jquery.getJSON('/middle_panel', filters, function(payload) {
- _last_fetched_with = filters;
- JarrDispatcher.dispatch({
- type: ActionTypes.RELOAD_MIDDLE_PANEL,
- articles: payload.articles,
- });
+ reloadIfNecessaryAndDispatch({
+ type: ActionTypes.RELOAD_MIDDLE_PANEL,
});
},
search: function(search) {
bgstack15