refactor: lint

This commit is contained in:
liyasthomas
2021-05-17 19:17:57 +05:30
parent e424d06026
commit d9ddc184cb
21 changed files with 455 additions and 364 deletions

View File

@@ -4,33 +4,35 @@
<label for="body">{{ $t("response_body") }}</label>
<div>
<button
v-if="response.body"
ref="ToggleExpandResponse"
v-tooltip="{
content: !expandResponse
? $t('expand_response')
: $t('collapse_response'),
}"
class="icon"
@click="ToggleExpandResponse"
ref="ToggleExpandResponse"
v-if="response.body"
v-tooltip="{
content: !expandResponse ? $t('expand_response') : $t('collapse_response'),
}"
>
<i class="material-icons">
{{ !expandResponse ? "unfold_more" : "unfold_less" }}
</i>
</button>
<button
v-if="response.body"
ref="downloadResponse"
v-tooltip="$t('download_file')"
class="icon"
@click="downloadResponse"
ref="downloadResponse"
v-if="response.body"
v-tooltip="$t('download_file')"
>
<i class="material-icons">save_alt</i>
</button>
<button
v-if="response.body"
ref="copyResponse"
v-tooltip="$t('copy_response')"
class="icon"
@click="copyResponse"
ref="copyResponse"
v-if="response.body"
v-tooltip="$t('copy_response')"
>
<i class="material-icons">content_copy</i>
</button>
@@ -61,7 +63,7 @@ import TextContentRendererMixin from "./mixins/TextContentRendererMixin"
export default {
mixins: [TextContentRendererMixin],
props: {
response: {},
response: { type: Object, default: () => {} },
},
data() {
return {
@@ -74,13 +76,16 @@ export default {
},
computed: {
responseType() {
return (this.response.headers["content-type"] || "").split(";")[0].toLowerCase()
return (this.response.headers["content-type"] || "")
.split(";")[0]
.toLowerCase()
},
},
methods: {
ToggleExpandResponse() {
this.expandResponse = !this.expandResponse
this.responseBodyMaxLines = this.responseBodyMaxLines == Infinity ? 16 : Infinity
this.responseBodyMaxLines =
this.responseBodyMaxLines === Infinity ? 16 : Infinity
},
downloadResponse() {
const dataToWrite = this.responseBodyText
@@ -114,7 +119,10 @@ export default {
aux.select()
document.execCommand("copy")
document.body.removeChild(aux)
setTimeout(() => (this.$refs.copyResponse.innerHTML = this.copyButton), 1000)
setTimeout(
() => (this.$refs.copyResponse.innerHTML = this.copyButton),
1000
)
},
},
}