Merge branch 'master' into dependabot/npm_and_yarn/nuxt-i18n-6.12.2
This commit is contained in:
@@ -118,8 +118,8 @@
|
||||
</button>
|
||||
<button
|
||||
class="icon"
|
||||
@click="downloadResponse"
|
||||
ref="downloadResponse"
|
||||
@click="downloadSchema"
|
||||
ref="downloadSchema"
|
||||
v-tooltip="$t('download_file')"
|
||||
>
|
||||
<i class="material-icons">get_app</i>
|
||||
@@ -221,6 +221,14 @@
|
||||
<div class="flex-wrap">
|
||||
<label for="responseField">{{ $t("response") }}</label>
|
||||
<div>
|
||||
<button
|
||||
class="icon"
|
||||
@click="downloadResponse"
|
||||
ref="downloadResponse"
|
||||
v-tooltip="$t('download_file')"
|
||||
>
|
||||
<i class="material-icons">get_app</i>
|
||||
</button>
|
||||
<button
|
||||
class="icon"
|
||||
@click="copyResponse"
|
||||
@@ -667,12 +675,12 @@ export default {
|
||||
this.responseBodyMaxLines = this.responseBodyMaxLines == Infinity ? 16 : Infinity
|
||||
},
|
||||
downloadResponse() {
|
||||
const dataToWrite = JSON.stringify(this.schema, null, 2)
|
||||
const dataToWrite = this.response
|
||||
const file = new Blob([dataToWrite], { type: "application/json" })
|
||||
const a = document.createElement("a")
|
||||
const url = URL.createObjectURL(file)
|
||||
a.href = url
|
||||
a.download = `${this.url} on ${Date()}.graphql`.replace(/\./g, "[dot]")
|
||||
a.download = `Response ${this.url} on ${Date()}.json`.replace(/\./g, "[dot]")
|
||||
document.body.appendChild(a)
|
||||
a.click()
|
||||
this.$refs.downloadResponse.innerHTML = this.doneButton
|
||||
@@ -685,6 +693,25 @@ export default {
|
||||
this.$refs.downloadResponse.innerHTML = this.downloadButton
|
||||
}, 1000)
|
||||
},
|
||||
downloadSchema() {
|
||||
const dataToWrite = JSON.stringify(this.schema, null, 2)
|
||||
const file = new Blob([dataToWrite], { type: "application/json" })
|
||||
const a = document.createElement("a")
|
||||
const url = URL.createObjectURL(file)
|
||||
a.href = url
|
||||
a.download = `${this.url} on ${Date()}.graphql`.replace(/\./g, "[dot]")
|
||||
document.body.appendChild(a)
|
||||
a.click()
|
||||
this.$refs.downloadSchema.innerHTML = this.doneButton
|
||||
this.$toast.success(this.$t("download_started"), {
|
||||
icon: "done",
|
||||
})
|
||||
setTimeout(() => {
|
||||
document.body.removeChild(a)
|
||||
window.URL.revokeObjectURL(url)
|
||||
this.$refs.downloadSchema.innerHTML = this.downloadButton
|
||||
}, 1000)
|
||||
},
|
||||
addRequestHeader(index) {
|
||||
this.$store.commit("addGQLHeader", {
|
||||
key: "",
|
||||
|
||||
Reference in New Issue
Block a user