Sha256: c70aa51b3128c0e2aa6f1268dcad0fecc0be9ac03272e7885e9a9a1b40eb40d7
Contents?: true
Size: 783 Bytes
Versions: 3
Compression:
Stored size: 783 Bytes
Contents
import { API } from 'foremanReact/redux/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
3 entries across 3 versions & 1 rubygems