Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
gratcliff committed Sep 26, 2019
1 parent 51b0c14 commit 1190d55
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions packages/api-logs/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ function getLanguage(log) {
}

function checkFreshness(existingLogs, incomingLogs) {
if (existingLogs.length && existingLogs[0]._id !== incomingLogs[0]._id
|| !existingLogs.length) {
if (
(existingLogs.length && existingLogs[0]._id !== incomingLogs[0]._id) ||
!existingLogs.length
) {
return incomingLogs;
}
throw new Error('Requested logs are not up-to-date.');
Expand Down Expand Up @@ -90,11 +92,14 @@ class Logs extends React.Component {
Object.assign({}, query, { id: group || null, limit: 5, page: 0 }),
)}`;

return retry(async () => {
const res = await fetch(reqUrl);
const parsedLogs = await this.handleData(res);
return checkFreshness(this.state.logs, parsedLogs);
}, { minTimeout: 50 });
return retry(
async () => {
const res = await fetch(reqUrl);
const parsedLogs = await this.handleData(res);
return checkFreshness(this.state.logs, parsedLogs);
},
{ minTimeout: 50 },
);
}

async handleData(res) {
Expand Down

0 comments on commit 1190d55

Please sign in to comment.