This repository has been archived on 2024-11-03. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
mattermost-plugin-attachmen.../webapp/src/actions.js
2018-07-23 13:43:22 -04:00

31 lines
804 B
JavaScript

import PluginId from './plugin_id';
import {STATUS_CHANGE, OPEN_ROOT_MODAL, CLOSE_ROOT_MODAL} from './action_types';
export const openRootModal = () => (dispatch) => {
dispatch({
type: OPEN_ROOT_MODAL,
});
};
export const closeRootModal = () => (dispatch) => {
dispatch({
type: CLOSE_ROOT_MODAL,
});
};
export const mainMenuAction = openRootModal;
export const channelHeaderButtonAction = openRootModal;
export const getStatus = () => (dispatch) => {
fetch('/plugins/' + PluginId + '/').then((r) => r.json()).then((r) => {
dispatch({
type: STATUS_CHANGE,
data: r.enabled,
});
});
};
export const websocketStatusChange = (message) => (dispatch) => dispatch({
type: STATUS_CHANGE,
data: message.data.enabled,
});