Sha256: d79bc078216a4a5f9a53abc1df51cfe1db3ca2f829dd1a21f3f59216a6f6d5d4
Contents?: true
Size: 1.02 KB
Versions: 19
Compression:
Stored size: 1.02 KB
Contents
import { foremanApi, foremanEndpoint } from '../../services/api'; import { GET_ORGANIZATIONS_LIST_SUCCESS, GET_ORGANIZATIONS_LIST_FAILURE, CHANGE_CURRENT_ORGANIZATION_SUCCESS, CHANGE_CURRENT_ORGANIZATION_FAILURE, GET_ORGANIZATIONS_LIST_REQUEST, } from '../../redux/consts'; export const getOrganiztionsList = () => (dispatch) => { dispatch({ type: GET_ORGANIZATIONS_LIST_REQUEST }); foremanApi .get('/organizations') .then(({ data }) => { dispatch({ type: GET_ORGANIZATIONS_LIST_SUCCESS, payload: data, }); }) .catch((result) => { dispatch({ type: GET_ORGANIZATIONS_LIST_FAILURE, payload: result, }); }); }; export const changeCurrentOrgaziation = orgID => dispatch => foremanEndpoint .get(`organizations/${orgID}/select`) .then(() => { dispatch({ type: CHANGE_CURRENT_ORGANIZATION_SUCCESS, payload: orgID, }); }) .catch(() => { dispatch({ type: CHANGE_CURRENT_ORGANIZATION_FAILURE, payload: orgID, }); });
Version data entries
19 entries across 19 versions & 1 rubygems