Sha256: 449f6142383105831aab275cf27113e1c54dc299938f3f25550dcc675657575b
Contents?: true
Size: 815 Bytes
Versions: 3
Compression:
Stored size: 815 Bytes
Contents
import api from 'foremanReact/API'; import { deepPropsToCamelCase } from 'foremanReact/common/helpers'; import { PREUPGRADE_REPORTS_REQUEST, PREUPGRADE_REPORTS_SUCCESS, PREUPGRADE_REPORTS_FAILURE, } from '../../consts'; export const getPreupgradeReports = url => async dispatch => { dispatch({ type: PREUPGRADE_REPORTS_REQUEST }); try { const { data } = await api.get(url); return dispatch({ type: PREUPGRADE_REPORTS_SUCCESS, payload: deepPropsToCamelCase(data), }); } catch (error) { return dispatch(errorHandler(PREUPGRADE_REPORTS_FAILURE, error)); } }; const errorHandler = (msg, err) => { const error = { errorMsg: 'Failed to fetch preupgrade reports from server.', statusText: err.response.statusText, }; return { type: msg, payload: { error } }; };
Version data entries
3 entries across 3 versions & 1 rubygems