aboutsummaryrefslogtreecommitdiff
path: root/src/web/js/actions/MiddlePanelActions.js
blob: f750c900d5546f2619e5a17183152575ca72350d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
var JarrDispatcher = require('../dispatcher/JarrDispatcher');
var MiddlePanelActionTypes = require('../constants/JarrConstants').MiddlePanelActionTypes;
var jquery = require('jquery');


var MiddlePanelActions = {
    reload: function() {
        jquery.getJSON('/middle_panel', function(payload) {
            JarrDispatcher.dispatch({
                type: MiddlePanelActionTypes.RELOAD_MIDDLE_PANEL,
                articles: payload.articles,
            });
        });
    },
    removeParentFilter: function(parent_type, parent_id) {
        JarrDispatcher.dispatch({
            type: MiddlePanelActionTypes.MIDDLE_PANEL_PARENT_FILTER,
            parent_type: null,
            parent_id: null,
        });
    },
    setCategoryFilter: function(category_id) {
        JarrDispatcher.dispatch({
            type: MiddlePanelActionTypes.MIDDLE_PANEL_PARENT_FILTER,
            parent_type: 'category',
            parent_id: category_id,
        });
    },
    setFeedFilter: function(feed_id) {
        JarrDispatcher.dispatch({
            type: MiddlePanelActionTypes.MIDDLE_PANEL_PARENT_FILTER,
            parent_type: 'feed',
            parent_id: feed_id,
        });
    },
    setFilterAll: function() {
        JarrDispatcher.dispatch({
            component: 'middle_panel',
            type: MiddlePanelActionTypes.MIDDLE_PANEL_FILTER_ALL,
        });
    },
    setFilterUnread: function() {
        JarrDispatcher.dispatch({
            component: 'middle_panel',
            type: MiddlePanelActionTypes.MIDDLE_PANEL_FILTER_UNREAD,
        });
    },
    setFilterLiked: function() {
        JarrDispatcher.dispatch({
            type: MiddlePanelActionTypes.MIDDLE_PANEL_FILTER_LIKED,
        });
    },
};

module.exports = MiddlePanelActions;
bgstack15