Skip to content

Commit

Permalink
chore: code clean up (#2428)
Browse files Browse the repository at this point in the history
  • Loading branch information
amir20 authored Oct 16, 2023
1 parent 37d2b07 commit 803b661
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions assets/composables/eventsource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,10 @@ export function useLogStream() {
clearMessages();
}

const params = {} as { stdout?: string; stderr?: string };
const params = Object.entries(streamConfig)
.filter(([, value]) => value)
.reduce((acc, [key]) => ({ ...acc, [key]: "1" }), {});

if (streamConfig.stdout) {
params.stdout = "1";
}
if (streamConfig.stderr) {
params.stderr = "1";
}
containerId = container.value.id;

console.debug(`Connecting to ${containerId} with params`, params);
Expand Down Expand Up @@ -116,17 +112,9 @@ export function useLogStream() {
const delta = to.getTime() - last.getTime();
const from = new Date(to.getTime() + delta);

const params = {
from: from.toISOString(),
to: to.toISOString(),
} as { from: string; to: string; stdout?: string; stderr?: string };

if (streamConfig.stdout) {
params.stdout = "1";
}
if (streamConfig.stderr) {
params.stderr = "1";
}
const params = Object.entries(streamConfig)
.filter(([, value]) => value)
.reduce((acc, [key]) => ({ ...acc, [key]: "1" }), { from: from.toISOString(), to: to.toISOString() });

const logs = await (
await fetch(
Expand Down

0 comments on commit 803b661

Please sign in to comment.