27 lines
744 B
Vue
27 lines
744 B
Vue
<script setup lang="ts">
|
|
import { computed } from "vue";
|
|
|
|
import CodeView from "@/base/CodeView.vue";
|
|
import { prettyPrint } from "./capture-payload";
|
|
|
|
/**
|
|
* One labelled block of a capture: its body or its headers, as text. Both are
|
|
* stored as strings, valid JSON or not, so both go through the same reader.
|
|
*/
|
|
const props = defineProps<{ label: string; raw?: string }>();
|
|
|
|
const text = computed(() => prettyPrint(props.raw));
|
|
</script>
|
|
|
|
<template>
|
|
<section class="min-w-0">
|
|
<h3
|
|
class="mb-2 text-xs font-semibold tracking-[0.05em] text-fg-subtle uppercase"
|
|
>
|
|
{{ label }}
|
|
</h3>
|
|
<p v-if="!text" class="text-sm text-fg-muted">(empty)</p>
|
|
<CodeView v-else :code="text" lang="json" />
|
|
</section>
|
|
</template>
|