+ client: use oldest param

This commit is contained in:
Ildar Kamalov
2019-11-13 19:09:40 +03:00
committed by Simon Zolin
parent 33093de6aa
commit 941b6c5976
3 changed files with 17 additions and 14 deletions

View File

@@ -14,9 +14,13 @@ export const getLogsSuccess = createAction('GET_LOGS_SUCCESS');
export const getLogs = config => async (dispatch) => {
dispatch(getLogsRequest());
try {
const { filter, lastRowTime: older_than } = config;
const logs = normalizeLogs(await apiClient.getQueryLog({ ...filter, older_than }));
dispatch(getLogsSuccess({ logs, ...config }));
const { filter, older_than } = config;
const rawLogs = await apiClient.getQueryLog({ ...filter, older_than });
const { data, oldest } = rawLogs;
const logs = normalizeLogs(data);
dispatch(getLogsSuccess({
logs, oldest, filter, ...config,
}));
} catch (error) {
dispatch(addErrorToast({ error }));
dispatch(getLogsFailure(error));