mattermost-mobile/app/actions/websocket/apps.ts
Michael Kochell 0a4ec73ee3
[MM-34233] Only refresh App bindings if apps plugin is enabled (#5673)
Co-authored-by: Daniel Espino García <larkox@gmail.com>
2022-03-28 13:45:29 -04:00

29 lines
832 B
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import AppsTypes from '@mm-redux/action_types/apps';
import {refreshAppBindings} from '@mm-redux/actions/apps';
import {ActionResult, DispatchFunc, GetStateFunc} from '@mm-redux/types/actions';
import {appsEnabled} from '@utils/apps';
export function handleRefreshAppsBindings() {
return (dispatch: DispatchFunc, getState: GetStateFunc): ActionResult => {
if (appsEnabled(getState())) {
dispatch(refreshAppBindings());
}
return {data: true};
};
}
export function handleAppsPluginEnabled() {
return {
type: AppsTypes.APPS_PLUGIN_ENABLED,
};
}
export function handleAppsPluginDisabled() {
return {
type: AppsTypes.APPS_PLUGIN_DISABLED,
};
}