parent
fd82e7c26a
commit
6f2e852e09
|
@ -139,6 +139,36 @@ export const toggleProtection = status => async (dispatch) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const getVersionRequest = createAction('GET_VERSION_REQUEST');
|
||||||
|
export const getVersionFailure = createAction('GET_VERSION_FAILURE');
|
||||||
|
export const getVersionSuccess = createAction('GET_VERSION_SUCCESS');
|
||||||
|
|
||||||
|
export const getVersion = () => async (dispatch) => {
|
||||||
|
dispatch(getVersionRequest());
|
||||||
|
try {
|
||||||
|
const newVersion = await apiClient.getGlobalVersion();
|
||||||
|
dispatch(getVersionSuccess(newVersion));
|
||||||
|
} catch (error) {
|
||||||
|
dispatch(addErrorToast({ error }));
|
||||||
|
dispatch(getVersionFailure());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getClientsRequest = createAction('GET_CLIENTS_REQUEST');
|
||||||
|
export const getClientsFailure = createAction('GET_CLIENTS_FAILURE');
|
||||||
|
export const getClientsSuccess = createAction('GET_CLIENTS_SUCCESS');
|
||||||
|
|
||||||
|
export const getClients = () => async (dispatch) => {
|
||||||
|
dispatch(getClientsRequest());
|
||||||
|
try {
|
||||||
|
const clients = await apiClient.getGlobalClients();
|
||||||
|
dispatch(getClientsSuccess(clients));
|
||||||
|
} catch (error) {
|
||||||
|
dispatch(addErrorToast({ error }));
|
||||||
|
dispatch(getClientsFailure());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
export const dnsStatusRequest = createAction('DNS_STATUS_REQUEST');
|
export const dnsStatusRequest = createAction('DNS_STATUS_REQUEST');
|
||||||
export const dnsStatusFailure = createAction('DNS_STATUS_FAILURE');
|
export const dnsStatusFailure = createAction('DNS_STATUS_FAILURE');
|
||||||
export const dnsStatusSuccess = createAction('DNS_STATUS_SUCCESS');
|
export const dnsStatusSuccess = createAction('DNS_STATUS_SUCCESS');
|
||||||
|
@ -148,6 +178,8 @@ export const getDnsStatus = () => async (dispatch) => {
|
||||||
try {
|
try {
|
||||||
const dnsStatus = await apiClient.getGlobalStatus();
|
const dnsStatus = await apiClient.getGlobalStatus();
|
||||||
dispatch(dnsStatusSuccess(dnsStatus));
|
dispatch(dnsStatusSuccess(dnsStatus));
|
||||||
|
dispatch(getVersion());
|
||||||
|
dispatch(getClients());
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
dispatch(addErrorToast({ error }));
|
dispatch(addErrorToast({ error }));
|
||||||
dispatch(initSettingsFailure());
|
dispatch(initSettingsFailure());
|
||||||
|
@ -205,21 +237,6 @@ export const getStats = () => async (dispatch) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getVersionRequest = createAction('GET_VERSION_REQUEST');
|
|
||||||
export const getVersionFailure = createAction('GET_VERSION_FAILURE');
|
|
||||||
export const getVersionSuccess = createAction('GET_VERSION_SUCCESS');
|
|
||||||
|
|
||||||
export const getVersion = () => async (dispatch) => {
|
|
||||||
dispatch(getVersionRequest());
|
|
||||||
try {
|
|
||||||
const newVersion = await apiClient.getGlobalVersion();
|
|
||||||
dispatch(getVersionSuccess(newVersion));
|
|
||||||
} catch (error) {
|
|
||||||
dispatch(addErrorToast({ error }));
|
|
||||||
dispatch(getVersionFailure());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getTopStatsRequest = createAction('GET_TOP_STATS_REQUEST');
|
export const getTopStatsRequest = createAction('GET_TOP_STATS_REQUEST');
|
||||||
export const getTopStatsFailure = createAction('GET_TOP_STATS_FAILURE');
|
export const getTopStatsFailure = createAction('GET_TOP_STATS_FAILURE');
|
||||||
export const getTopStatsSuccess = createAction('GET_TOP_STATS_SUCCESS');
|
export const getTopStatsSuccess = createAction('GET_TOP_STATS_SUCCESS');
|
||||||
|
@ -665,18 +682,3 @@ export const toggleDhcp = config => async (dispatch) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getClientsRequest = createAction('GET_CLIENTS_REQUEST');
|
|
||||||
export const getClientsFailure = createAction('GET_CLIENTS_FAILURE');
|
|
||||||
export const getClientsSuccess = createAction('GET_CLIENTS_SUCCESS');
|
|
||||||
|
|
||||||
export const getClients = () => async (dispatch) => {
|
|
||||||
dispatch(getClientsRequest());
|
|
||||||
try {
|
|
||||||
const clients = await apiClient.getGlobalClients();
|
|
||||||
dispatch(getClientsSuccess(clients));
|
|
||||||
} catch (error) {
|
|
||||||
dispatch(addErrorToast({ error }));
|
|
||||||
dispatch(getClientsFailure());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
|
@ -25,8 +25,6 @@ import i18n from '../../i18n';
|
||||||
class App extends Component {
|
class App extends Component {
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.props.getDnsStatus();
|
this.props.getDnsStatus();
|
||||||
this.props.getVersion();
|
|
||||||
this.props.getClients();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate(prevProps) {
|
componentDidUpdate(prevProps) {
|
||||||
|
@ -106,10 +104,8 @@ App.propTypes = {
|
||||||
dashboard: PropTypes.object,
|
dashboard: PropTypes.object,
|
||||||
isCoreRunning: PropTypes.bool,
|
isCoreRunning: PropTypes.bool,
|
||||||
error: PropTypes.string,
|
error: PropTypes.string,
|
||||||
getVersion: PropTypes.func,
|
|
||||||
changeLanguage: PropTypes.func,
|
changeLanguage: PropTypes.func,
|
||||||
encryption: PropTypes.object,
|
encryption: PropTypes.object,
|
||||||
getClients: PropTypes.func,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default withNamespaces()(App);
|
export default withNamespaces()(App);
|
||||||
|
|
Loading…
Reference in New Issue