- client: check version on update before page reload
This commit is contained in:
parent
a165410c9f
commit
10a0873bc8
|
@ -160,7 +160,9 @@ export const getUpdateRequest = createAction('GET_UPDATE_REQUEST');
|
||||||
export const getUpdateFailure = createAction('GET_UPDATE_FAILURE');
|
export const getUpdateFailure = createAction('GET_UPDATE_FAILURE');
|
||||||
export const getUpdateSuccess = createAction('GET_UPDATE_SUCCESS');
|
export const getUpdateSuccess = createAction('GET_UPDATE_SUCCESS');
|
||||||
|
|
||||||
export const getUpdate = () => async (dispatch) => {
|
export const getUpdate = () => async (dispatch, getState) => {
|
||||||
|
const { dnsVersion } = getState().dashboard;
|
||||||
|
|
||||||
dispatch(getUpdateRequest());
|
dispatch(getUpdateRequest());
|
||||||
try {
|
try {
|
||||||
await apiClient.getUpdate();
|
await apiClient.getUpdate();
|
||||||
|
@ -185,9 +187,13 @@ export const getUpdate = () => async (dispatch) => {
|
||||||
axios.get('control/status')
|
axios.get('control/status')
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
rmTimeout(timeout);
|
rmTimeout(timeout);
|
||||||
if (response) {
|
if (response && response.status === 200) {
|
||||||
dispatch(getUpdateSuccess());
|
const responseVersion = response.data && response.data.version;
|
||||||
window.location.reload(true);
|
|
||||||
|
if (dnsVersion !== responseVersion) {
|
||||||
|
dispatch(getUpdateSuccess());
|
||||||
|
window.location.reload(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
timeout = setRecursiveTimeout(CHECK_TIMEOUT, count += 1);
|
timeout = setRecursiveTimeout(CHECK_TIMEOUT, count += 1);
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue