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-4.5.0 webpack/__mocks__/foremanReact/redux/API/APISelectors.js