loadReleaseNotes
parent
67791ffe3e
commit
c591291917
|
@ -4,13 +4,15 @@ import { connect } from "react-redux";
|
||||||
import { bindActionCreators } from "redux";
|
import { bindActionCreators } from "redux";
|
||||||
import {
|
import {
|
||||||
loadSystemDateTime,
|
loadSystemDateTime,
|
||||||
loadSystemVersion
|
loadSystemVersion,
|
||||||
|
loadReleaseNotes
|
||||||
} from "../../features/system/actionCreators";
|
} from "../../features/system/actionCreators";
|
||||||
|
|
||||||
const HomePage = ({ actions }) => {
|
const HomePage = ({ actions }) => {
|
||||||
const testButton = () => {
|
const testButton = () => {
|
||||||
actions.loadSystemDateTime();
|
actions.loadSystemDateTime();
|
||||||
actions.loadSystemVersion();
|
actions.loadSystemVersion();
|
||||||
|
actions.loadReleaseNotes();
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -39,7 +41,7 @@ function mapStateToProps(state) {
|
||||||
function mapDispatchToProps(dispatch) {
|
function mapDispatchToProps(dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators(
|
actions: bindActionCreators(
|
||||||
{ loadSystemDateTime, loadSystemVersion },
|
{ loadSystemDateTime, loadSystemVersion, loadReleaseNotes },
|
||||||
dispatch
|
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_DATETIME_SUCCESS = "LOAD_SYSTEM_DATETIME_SUCCESS";
|
||||||
export const LOAD_SYSTEM_VERSION_SUCCESS = "LOAD_SYSTEM_VERSION_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 = () =>
|
const getSystemVersion = () =>
|
||||||
fetch(`${baseUrl}/version`).then(handleResponse).catch(handleError);
|
fetch(`${baseUrl}/version`).then(handleResponse).catch(handleError);
|
||||||
|
|
||||||
|
const getReleaseNotes = () =>
|
||||||
|
fetch(`${baseUrl}/release-notes`).then(handleResponse).catch(handleError);
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
getSystemDateTime,
|
getSystemDateTime,
|
||||||
getSystemVersion
|
getSystemVersion,
|
||||||
|
getReleaseNotes
|
||||||
};
|
};
|
||||||
|
|
|
@ -15,6 +15,12 @@ export default function systemReducer(state = initialState.system, action) {
|
||||||
...action.payload
|
...action.payload
|
||||||
};
|
};
|
||||||
|
|
||||||
|
case types.LOAD_RELEASE_NOTES_SUCCESS:
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
releaseNotes: action.payload
|
||||||
|
};
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue