Sha256: d4199f7d6bdbc644e9a55deed11639fed58e870274a5652dd0135b80f41535c9

Contents?: true

Size: 662 Bytes

Versions: 81

Compression:

Stored size: 662 Bytes

Contents

export const selectAPI = state => state;
export const selectAPIByKey = (state, key) => selectAPI(state)[key] || {};

export const selectAPIStatus = (state, key) =>
  selectAPIByKey(state, key).status;

export const selectAPIPayload = (state, key) =>
  selectAPIByKey(state, key).payload || {};

export const selectAPIResponse = (state, key) =>
  selectAPIByKey(state, key).response || {};

export const selectAPIError = (state, key) =>
  selectAPIStatus(state, key) === 'ERROR'
    ? selectAPIResponse(state, key)
    : null;

export const selectAPIErrorMessage = (state, key) => {
  const error = selectAPIError(state, key);
  return error && error.message;
};

Version data entries

81 entries across 81 versions & 1 rubygems

Version Path
foreman_remote_execution-15.0.0 webpack/__mocks__/foremanReact/redux/API/APISelectors.js
foreman_remote_execution-14.1.4 webpack/__mocks__/foremanReact/redux/API/APISelectors.js
foreman_remote_execution-14.1.3 webpack/__mocks__/foremanReact/redux/API/APISelectors.js
foreman_remote_execution-14.1.2 webpack/__mocks__/foremanReact/redux/API/APISelectors.js
foreman_remote_execution-14.1.1 webpack/__mocks__/foremanReact/redux/API/APISelectors.js
foreman_remote_execution-14.1.0 webpack/__mocks__/foremanReact/redux/API/APISelectors.js
foreman_remote_execution-14.0.2 webpack/__mocks__/foremanReact/redux/API/APISelectors.js
foreman_remote_execution-14.0.1 webpack/__mocks__/foremanReact/redux/API/APISelectors.js
foreman_remote_execution-13.2.6 webpack/__mocks__/foremanReact/redux/API/APISelectors.js
foreman_remote_execution-14.0.0 webpack/__mocks__/foremanReact/redux/API/APISelectors.js
foreman_remote_execution-13.2.5 webpack/__mocks__/foremanReact/redux/API/APISelectors.js
foreman_remote_execution-13.2.4 webpack/__mocks__/foremanReact/redux/API/APISelectors.js
foreman_remote_execution-13.2.3 webpack/__mocks__/foremanReact/redux/API/APISelectors.js
foreman_remote_execution-13.2.2 webpack/__mocks__/foremanReact/redux/API/APISelectors.js
foreman_remote_execution-12.0.7 webpack/__mocks__/foremanReact/redux/API/APISelectors.js
foreman_remote_execution-13.2.1 webpack/__mocks__/foremanReact/redux/API/APISelectors.js
foreman_remote_execution-13.2.0 webpack/__mocks__/foremanReact/redux/API/APISelectors.js
foreman_remote_execution-10.1.3 webpack/__mocks__/foremanReact/redux/API/APISelectors.js
foreman_remote_execution-13.0.0 webpack/__mocks__/foremanReact/redux/API/APISelectors.js
foreman_remote_execution-12.0.5 webpack/__mocks__/foremanReact/redux/API/APISelectors.js