Sha256: ff0af1c9838efe846bef6f74a91c1752d19ec43b6e2819aeba39a5ce8e23af36
Contents?: true
Size: 773 Bytes
Versions: 19
Compression:
Stored size: 773 Bytes
Contents
import API from 'foremanReact/API'; import { addToast } from 'foremanReact/redux/actions/toasts'; import { inventoryUrl } from '../../ForemanInventoryHelpers'; import { AUTO_UPLOAD_TOGGLE } from './AutoUploadSwitcherConstants'; export const handleToggle = currentAutoUploadEnabled => async dispatch => { const toggledAutoUploadEnabled = !currentAutoUploadEnabled; try { const { data: { autoUploadEnabled }, } = await API.post(inventoryUrl('auto_upload'), { value: toggledAutoUploadEnabled, }); dispatch({ type: AUTO_UPLOAD_TOGGLE, payload: { autoUploadEnabled, }, }); } catch ({ message }) { dispatch( addToast({ sticky: true, type: 'error', message, }) ); } };
Version data entries
19 entries across 19 versions & 1 rubygems