mattermost-redux
Version:
Common code (API client, Redux stores, logic, utility functions) for building a Mattermost client
42 lines (41 loc) • 1.33 kB
JavaScript
;
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.remotes = remotes;
exports.remotesByRemoteId = remotesByRemoteId;
const redux_1 = require("redux");
const shared_channels_1 = __importDefault(require("../../action_types/shared_channels"));
function remotes(state = {}, action) {
switch (action.type) {
case shared_channels_1.default.RECEIVED_CHANNEL_REMOTES: {
const { channelId, remotes } = action.data;
return {
...state,
[channelId]: remotes,
};
}
default:
return state;
}
}
function remotesByRemoteId(state = {}, action) {
switch (action.type) {
case shared_channels_1.default.RECEIVED_REMOTE_CLUSTER_INFO: {
const { remoteId, remoteInfo } = action.data;
return {
...state,
[remoteId]: remoteInfo,
};
}
default:
return state;
}
}
exports.default = (0, redux_1.combineReducers)({
remotes,
remotesByRemoteId,
});