summaryrefslogtreecommitdiffstats
path: root/web/react/dispatcher/app_dispatcher.jsx
blob: 388e82a51298f8376328c870d7f80d60dda325cf (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
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.

var Dispatcher = require('flux').Dispatcher;
var assign = require('object-assign');

var Constants = require('../utils/constants.jsx');
var PayloadSources = Constants.PayloadSources;

var AppDispatcher = assign(new Dispatcher(), {
    handleServerAction: function performServerAction(action) {
        var payload = {
            source: PayloadSources.SERVER_ACTION,
            action: action
        };
        this.dispatch(payload);
    },

    handleViewAction: function performViewAction(action) {
        var payload = {
            source: PayloadSources.VIEW_ACTION,
            action: action
        };
        this.dispatch(payload);
    }
});

module.exports = AppDispatcher;