Skip to content

Commit

Permalink
fix: do not encode strings as JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
darlanalves authored May 14, 2024
1 parent 87b1335 commit a0aa647
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion components/Console.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
</form>

<Logs :logs="logs" class="my-4" />

<h2 class="font-bold mb-2">Available commands</h2>

<Logs :logs="commands" @update="fetchCommands()" />
</PageLayout>
</template>
Expand Down Expand Up @@ -77,7 +80,8 @@ async function onRun() {
const { args, command } = parseArgs(string);
try {
logs.value = JSON.stringify(await run(command, args), null, 2);
const response = await run(command, args);
logs.value = typeof response === 'string' ? response : JSON.stringify(response, null, 2) ;
commandInput.value = '';
} catch (error) {
logs.value = String(error);
Expand Down
2 changes: 1 addition & 1 deletion components/ui/Logs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<span class="material-icons text-sm text-white">refresh</span>
</button>
<div class="uppercase text-xs font-medium">{{ title }}</div>
<div>{{ logs }}</div>
<div class="text-sm">{{ logs }}</div>
</div>
</template>

Expand Down

0 comments on commit a0aa647

Please sign in to comment.