UNPKG

mattermost-redux

Version:

Common code (API client, Redux stores, logic, utility functions) for building a Mattermost client

42 lines (41 loc) 1.33 kB
"use strict"; // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. Object.defineProperty(exports, "__esModule", { value: true }); const redux_1 = require("redux"); const action_types_1 = require("../../action_types"); function agents(state = [], action) { switch (action.type) { case action_types_1.AgentTypes.RECEIVED_AGENTS: return action.data || []; case action_types_1.AgentTypes.AGENTS_FAILURE: return []; default: return state; } } function agentsStatus(state = { available: false }, action) { switch (action.type) { case action_types_1.AgentTypes.RECEIVED_AGENTS_STATUS: return action.data || { available: false }; case action_types_1.AgentTypes.AGENTS_STATUS_FAILURE: return { available: false }; default: return state; } } function llmServices(state = [], action) { switch (action.type) { case action_types_1.AgentTypes.RECEIVED_LLM_SERVICES: return action.data || []; case action_types_1.AgentTypes.LLM_SERVICES_FAILURE: return []; default: return state; } } exports.default = (0, redux_1.combineReducers)({ agents, agentsStatus, llmServices, });