reverse-proxy-frontend/src/features/system/actionCreators.js

26 lines
705 B
JavaScript

import * as types from "./actionTypes";
import api from "./api";
import { sendHttpRequest } from "../../redux/actions/httpActions";
export function loadSystemData() {
return async function(dispatch) {
try {
const data = await dispatch(sendHttpRequest(api.getSystemData()));
dispatch({ type: types.LOAD_SYSTEM_DATA_SUCCESS, payload: data });
} catch (error) {
throw error;
}
};
}
export function loadSystemVersion() {
return async function(dispatch) {
try {
const data = await dispatch(sendHttpRequest(api.getSystemVersion()));
dispatch({ type: types.LOAD_SYSTEM_VERSION_SUCCESS, payload: data });
} catch (error) {
throw error;
}
};
}