Files
hoppscotch/packages/hoppscotch-common/src/components/http/Response.vue
Nivedin 2bf0106aa2 feat: embeds (#3627)
Co-authored-by: Liyas Thomas <liyascthomas@gmail.com>
2023-12-07 15:03:49 +05:30

35 lines
831 B
Vue

<template>
<div class="relative flex flex-1 flex-col">
<HttpResponseMeta :response="doc.response" :is-embed="isEmbed" />
<LensesResponseBodyRenderer
v-if="!loading && hasResponse"
v-model:document="doc"
/>
</div>
</template>
<script setup lang="ts">
import { useVModel } from "@vueuse/core"
import { computed } from "vue"
import { HoppRESTDocument } from "~/helpers/rest/document"
const props = defineProps<{
document: HoppRESTDocument
isEmbed: boolean
}>()
const emit = defineEmits<{
(e: "update:tab", val: HoppRESTDocument): void
}>()
const doc = useVModel(props, "document", emit)
const hasResponse = computed(
() =>
doc.value.response?.type === "success" ||
doc.value.response?.type === "fail"
)
const loading = computed(() => doc.value.response?.type === "loading")
</script>