Sha256: 7ab5c902b76669e783790d4a60b9ed979a51455f82d9f7d6a9710fca609aca59
Contents?: true
Size: 885 Bytes
Versions: 13
Compression:
Stored size: 885 Bytes
Contents
import api from 'foremanReact/API'; import { deepPropsToCamelCase } from 'foremanReact/common/helpers'; import { translate as __ } from 'foremanReact/common/I18n'; import { PREUPGRADE_REPORTS_REQUEST, PREUPGRADE_REPORTS_SUCCESS, PREUPGRADE_REPORTS_FAILURE, } from '../../consts'; export const getPreupgradeReportsAction = 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
13 entries across 13 versions & 1 rubygems