Sha256: e6e1e114a9064a63ff673f81fab96119e75acb030abc9f1e4af9bc1935739f57

Contents?: true

Size: 812 Bytes

Versions: 3

Compression:

Stored size: 812 Bytes

Contents

import { API } from 'foremanReact/redux/API';
import { addToast } from 'foremanReact/redux/actions/toasts';
import { inventoryUrl } from '../../ForemanInventoryHelpers';
import { EXCLUDE_PACKAGES_TOGGLE } from './ExcludePackagesSwitcherConstants';

export const handleToggle = currentExcludePackages => async dispatch => {
  const toggledExcludePackages = !currentExcludePackages;
  try {
    const {
      data: { excludePackages },
    } = await API.post(inventoryUrl('installed_packages_inclusion'), {
      value: toggledExcludePackages,
    });
    dispatch({
      type: EXCLUDE_PACKAGES_TOGGLE,
      payload: {
        excludePackages,
      },
    });
  } catch (error) {
    dispatch(
      addToast({
        sticky: true,
        type: 'error',
        message: error.message,
      })
    );
  }
};

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
foreman_rh_cloud-3.0.17 webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/ExcludePackagesSwitcherActions.js
foreman_rh_cloud-3.0.16 webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/ExcludePackagesSwitcherActions.js
foreman_rh_cloud-3.0.15 webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/ExcludePackagesSwitcherActions.js