From a7b887b57d903f1f7ac967b861b5cc677728efc4 Mon Sep 17 00:00:00 2001 From: ArtemBaskal Date: Tue, 16 Jun 2020 15:42:20 +0300 Subject: [PATCH] Ignore clients find without params --- client/src/actions/queryLogs.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/client/src/actions/queryLogs.js b/client/src/actions/queryLogs.js index c1b41aff7bc..2a230622996 100644 --- a/client/src/actions/queryLogs.js +++ b/client/src/actions/queryLogs.js @@ -9,13 +9,16 @@ const getLogsWithParams = async (config) => { const { older_than, filter, ...values } = config; const rawLogs = await apiClient.getQueryLog({ ...filter, older_than }); const { data, oldest } = rawLogs; - const logs = normalizeLogs(data); + let logs = normalizeLogs(data); const clientsParams = getParamsForClientsSearch(logs, 'client'); - const clients = await apiClient.findClients(clientsParams); - const logsWithClientInfo = addClientInfo(logs, clients, 'client'); + + if (Object.keys(clientsParams).length > 0) { + const clients = await apiClient.findClients(clientsParams); + logs = addClientInfo(logs, clients, 'client'); + } return { - logs: logsWithClientInfo, oldest, older_than, filter, ...values, + logs, oldest, older_than, filter, ...values, }; };