Implemented proper editors (#236)
Co-authored-by: widlam <mikolaj.widla@gmail.com> Reviewed-on: #236 Reviewed-by: Adam Bem <bema@noreply.example.com> Co-authored-by: Mikolaj Widla <widlam@noreply.example.com> Co-committed-by: Mikolaj Widla <widlam@noreply.example.com>
This commit is contained in:
@@ -7,8 +7,9 @@ import HeadersDetailComponent from './HeadersDetailComponent.vue';
|
||||
const shownDetail = ref('none');
|
||||
const currentShownData = ref('');
|
||||
const currentIndex = ref(-1);
|
||||
const currentContentType = ref('application/json');
|
||||
|
||||
function showBody(body : string, index: number){
|
||||
function showBody(body : string, index: number, contentType : string){
|
||||
if( currentIndex.value == index && shownDetail.value == "body" ){
|
||||
shownDetail.value = "none";
|
||||
} else {
|
||||
@@ -16,6 +17,7 @@ function showBody(body : string, index: number){
|
||||
shownDetail.value = "body";
|
||||
currentShownData.value = body;
|
||||
}
|
||||
currentContentType.value = contentType;
|
||||
}
|
||||
|
||||
function showHeaders(headers: object, index: number){
|
||||
@@ -34,7 +36,7 @@ function showHeaders(headers: object, index: number){
|
||||
<template>
|
||||
<div class="w-full xl:w-5/12 flex flex-col gap-y-4">
|
||||
<HistoryRecords class="h-1/3 overflow-y-scroll" @click:show-headers="showHeaders" @click:show-body="showBody"></HistoryRecords>
|
||||
<BodyDetailComponent :data="currentShownData" v-if="shownDetail == 'body' "></BodyDetailComponent>
|
||||
<BodyDetailComponent :content-type="currentContentType" :data="currentShownData" v-if="shownDetail == 'body' "></BodyDetailComponent>
|
||||
<HeadersDetailComponent :data="currentShownData" v-if="shownDetail == 'headers' "></HeadersDetailComponent>
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user