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

Version Path
katello-4.14.2 webpack/components/SelectOrg/SelectOrgAction.js
katello-4.15.0 webpack/components/SelectOrg/SelectOrgAction.js
katello-4.15.0.rc2 webpack/components/SelectOrg/SelectOrgAction.js
katello-4.15.0.rc1 webpack/components/SelectOrg/SelectOrgAction.js
katello-4.14.1 webpack/components/SelectOrg/SelectOrgAction.js
katello-4.14.0 webpack/components/SelectOrg/SelectOrgAction.js
katello-4.14.0.rc3 webpack/components/SelectOrg/SelectOrgAction.js
katello-4.14.0.rc2 webpack/components/SelectOrg/SelectOrgAction.js
katello-4.14.0.rc1.1 webpack/components/SelectOrg/SelectOrgAction.js
katello-4.14.0.rc1 webpack/components/SelectOrg/SelectOrgAction.js
katello-4.13.1 webpack/components/SelectOrg/SelectOrgAction.js
katello-4.13.0 webpack/components/SelectOrg/SelectOrgAction.js
katello-4.12.1 webpack/components/SelectOrg/SelectOrgAction.js
katello-4.13.0.rc1 webpack/components/SelectOrg/SelectOrgAction.js
katello-4.12.0 webpack/components/SelectOrg/SelectOrgAction.js
katello-4.12.0.rc3 webpack/components/SelectOrg/SelectOrgAction.js
katello-4.12.0.rc2 webpack/components/SelectOrg/SelectOrgAction.js
katello-4.12.0.rc1 webpack/components/SelectOrg/SelectOrgAction.js
katello-4.11.1 webpack/components/SelectOrg/SelectOrgAction.js
katello-4.11.0 webpack/components/SelectOrg/SelectOrgAction.js