loadReleaseNotes
parent
67791ffe3e
commit
c591291917
|
@ -4,13 +4,15 @@ import { connect } from "react-redux";
|
|||
import { bindActionCreators } from "redux";
|
||||
import {
|
||||
loadSystemDateTime,
|
||||
loadSystemVersion
|
||||
loadSystemVersion,
|
||||
loadReleaseNotes
|
||||
} from "../../features/system/actionCreators";
|
||||
|
||||
const HomePage = ({ actions }) => {
|
||||
const testButton = () => {
|
||||
actions.loadSystemDateTime();
|
||||
actions.loadSystemVersion();
|
||||
actions.loadReleaseNotes();
|
||||
};
|
||||
|
||||
return (
|
||||
|
@ -39,7 +41,7 @@ function mapStateToProps(state) {
|
|||
function mapDispatchToProps(dispatch) {
|
||||
return {
|
||||
actions: bindActionCreators(
|
||||
{ loadSystemDateTime, loadSystemVersion },
|
||||
{ loadSystemDateTime, loadSystemVersion, loadReleaseNotes },
|
||||
dispatch
|
||||
)
|
||||
};
|
||||
|
|
|
@ -30,3 +30,16 @@ export function loadSystemVersion() {
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
export function loadReleaseNotes() {
|
||||
return async function (dispatch) {
|
||||
dispatch(beginApiCall());
|
||||
try {
|
||||
const data = await api.getReleaseNotes();
|
||||
dispatch({ type: types.LOAD_RELEASE_NOTES_SUCCESS, payload: data });
|
||||
} catch (error) {
|
||||
dispatch(apiCallError(error));
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
export const LOAD_SYSTEM_DATETIME_SUCCESS = "LOAD_SYSTEM_DATETIME_SUCCESS";
|
||||
export const LOAD_SYSTEM_VERSION_SUCCESS = "LOAD_SYSTEM_VERSION_SUCCESS";
|
||||
export const LOAD_RELEASE_NOTES_SUCCESS = "LOAD_RELEASE_NOTES_SUCCESS";
|
||||
|
|
|
@ -7,7 +7,11 @@ const getSystemDateTime = () =>
|
|||
const getSystemVersion = () =>
|
||||
fetch(`${baseUrl}/version`).then(handleResponse).catch(handleError);
|
||||
|
||||
const getReleaseNotes = () =>
|
||||
fetch(`${baseUrl}/release-notes`).then(handleResponse).catch(handleError);
|
||||
|
||||
export default {
|
||||
getSystemDateTime,
|
||||
getSystemVersion
|
||||
getSystemVersion,
|
||||
getReleaseNotes
|
||||
};
|
||||
|
|
|
@ -15,6 +15,12 @@ export default function systemReducer(state = initialState.system, action) {
|
|||
...action.payload
|
||||
};
|
||||
|
||||
case types.LOAD_RELEASE_NOTES_SUCCESS:
|
||||
return {
|
||||
...state,
|
||||
releaseNotes: action.payload
|
||||
};
|
||||
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue