Sha256: 927f06bdcca124b28198e1f9a16f96fadb4406f85a96d17d0918e9ab19b4eb2d
Contents?: true
Size: 744 Bytes
Versions: 18
Compression:
Stored size: 744 Bytes
Contents
import API from 'foremanReact/API'; import { inventoryUrl } from '../../ForemanInventoryHelpers'; import { AUTO_UPLOAD_TOGGLE, AUTO_UPLOAD_TOGGLE_ERROR, } 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 (error) { dispatch({ type: AUTO_UPLOAD_TOGGLE_ERROR, payload: { error: error.message, }, }); } };
Version data entries
18 entries across 18 versions & 1 rubygems