Sha256: 85127cdc0c5327d20c6eed556f194cbf78babd4a157d8f5363802f2fb5343ee9
Contents?: true
Size: 1.03 KB
Versions: 152
Compression:
Stored size: 1.03 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 = () => async (dispatch) => { dispatch({ type: GET_ORGANIZATIONS_LIST_REQUEST }); try { const { data } = await foremanApi.get('/organizations'); return dispatch({ type: GET_ORGANIZATIONS_LIST_SUCCESS, payload: data, }); } catch (error) { return dispatch({ type: GET_ORGANIZATIONS_LIST_FAILURE, payload: error, }); } }; export const changeCurrentOrganization = orgID => async (dispatch) => { try { await foremanEndpoint.get(`organizations/${orgID}/select`); return dispatch({ type: CHANGE_CURRENT_ORGANIZATION_SUCCESS, payload: orgID, }); } catch (e) { return dispatch({ type: CHANGE_CURRENT_ORGANIZATION_FAILURE, payload: orgID, }); } };
Version data entries
152 entries across 152 versions & 1 rubygems