Sha256: 6cddce717f32179c698ffb8f898d369db4192bb53b07352c7d275709c7954324
Contents?: true
Size: 1.38 KB
Versions: 9
Compression:
Stored size: 1.38 KB
Contents
import API from 'foremanReact/API'; import { insightsCloudUrl } from '../../InsightsCloudSyncHelpers'; import { INSIGHTS_SYNC_SETTING_SET, INSIGHTS_SYNC_SETTING_SET_FAILURE, INSIGHTS_SYNC_SETTINGS_GET_SUCCESS, INSIGHTS_SYNC_SETTINGS_GET_FAILURE, } from './InsightsSettingsConstants'; export const getInsightsSyncSettings = () => async dispatch => { try { const { data: { insightsSyncEnabled }, } = await API.get(insightsCloudUrl('settings')); dispatch({ type: INSIGHTS_SYNC_SETTINGS_GET_SUCCESS, payload: { settings: { insightsSyncEnabled, }, }, }); } catch (error) { dispatch({ type: INSIGHTS_SYNC_SETTINGS_GET_FAILURE, payload: { settings: { error: error.message, }, }, }); } }; export const setInsightsSyncEnabled = currentInsightsSyncEnabled => async dispatch => { try { const { data: { insightsSyncEnabled }, } = await API.patch(insightsCloudUrl('settings'), { insightsSyncEnabled: currentInsightsSyncEnabled, }); dispatch({ type: INSIGHTS_SYNC_SETTING_SET, payload: { settings: { insightsSyncEnabled, }, }, }); } catch (error) { dispatch({ type: INSIGHTS_SYNC_SETTING_SET_FAILURE, payload: { settings: { error: error.message, }, }, }); } };
Version data entries
9 entries across 9 versions & 1 rubygems