Revert 'Prettify button for RAW responses'

This commit is contained in:
Liyas Thomas
2020-06-23 12:17:51 +05:30
parent a885e774fc
commit 0b38514e41

View File

@@ -17,15 +17,6 @@
{{ !expandResponse ? "unfold_more" : "unfold_less" }}
</i>
</button>
<button
class="icon"
ref="prettifyResponse"
@click="prettifyResponseBody"
v-tooltip="$t('prettify_body')"
v-if="response.body && this.responseType.endsWith('json')"
>
<i class="material-icons">photo_filter</i>
</button>
<button
class="icon"
@click="downloadResponse"
@@ -137,19 +128,6 @@ export default {
document.body.removeChild(aux)
setTimeout(() => (this.$refs.copyResponse.innerHTML = this.copyButton), 1000)
},
prettifyResponseBody() {
try {
const jsonObj = JSON.parse(this.responseBodyText)
this.responseBodyText = JSON.stringify(jsonObj, null, 2)
let oldIcon = this.$refs.prettifyResponse.innerHTML
this.$refs.prettifyResponse.innerHTML = this.doneButton
setTimeout(() => (this.$refs.prettifyResponse.innerHTML = oldIcon), 1000)
} catch (e) {
this.$toast.error(`${this.$t("json_prettify_invalid_body")}`, {
icon: "error",
})
}
},
},
}
</script>