Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
♻️ Refactor
Liyas Thomas1d6d8af74846
diff --git a/components/ace-editor.vue b/components/ace-editor.vueindex 3f2745147..5065b7994 100644--- a/components/ace-editor.vue+++ b/components/ace-editor.vue@@ -55,8 +55,8 @@ export default {mounted() {const editor = ace.edit(this.$refs.editor, {- theme: "ace/theme/" + this.defineTheme(),- mode: "ace/mode/" + this.lang,+ theme: `ace/theme/${this.defineTheme()}`,+ mode: `ace/mode/${this.lang}`,...this.options});@@ -74,13 +74,10 @@ export default {methods: {defineTheme() {- if (this.theme) {- return this.theme;- } else {- return (- this.$store.state.postwoman.settings.THEME_ACE_EDITOR || DEFAULT_THEME- );- }+ if (this.theme) return this.theme;+ return (+ this.$store.state.postwoman.settings.THEME_ACE_EDITOR || DEFAULT_THEME+ );}},diff --git a/pages/doc.vue b/pages/doc.vueindex 963687d4d..07dabf4de 100644--- a/pages/doc.vue+++ b/pages/doc.vue@@ -363,8 +363,8 @@ export default {let file = this.$refs.collectionUpload.files[0];if (file !== undefined && file !== null) {let reader = new FileReader();- reader.onload = e => {- this.collectionJSON = e.target.result;+ reader.onload = ({ target }) => {+ this.collectionJSON = target.result;};reader.readAsText(file);this.$toast.info(this.$t("file_imported"), {diff --git a/pages/graphql.vue b/pages/graphql.vueindex 127f74428..f81d37145 100644--- a/pages/graphql.vue+++ b/pages/graphql.vue@@ -531,7 +531,10 @@ export default {return this.$store.state.gql.variablesJSONString;},set(value) {- this.$store.commit("setGQLState", { value, attribute: "variablesJSONString" });+ this.$store.commit("setGQLState", {+ value,+ attribute: "variablesJSONString"+ });}},headerString() {@@ -620,7 +623,7 @@ export default {this.headers.forEach(header => {headers[header.key] = header.value;});-+let variables = JSON.parse(this.variableString);const gqlQueryString = this.gqlQueryString;@@ -780,13 +783,10 @@ export default {downloadResponse() {const dataToWrite = JSON.stringify(this.schemaString, null, 2);const file = new Blob([dataToWrite], { type: "application/json" });- const a = document.createElement("a"),- url = URL.createObjectURL(file);+ 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 = `${this.url} on ${Date()}.graphql`.replace(/\./g, "[dot]");document.body.appendChild(a);a.click();this.$refs.downloadResponse.innerHTML = this.doneButton;diff --git a/pages/realtime.vue b/pages/realtime.vueindex 1ef1a49b6..9e97c4d06 100644--- a/pages/realtime.vue+++ b/pages/realtime.vue@@ -211,24 +211,20 @@ export default {urlValid() {const protocol = "^(wss?:\\/\\/)?";const validIP = new RegExp(- protocol +- "(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]).){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$"+ `${protocol}(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]).){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$`);const validHostname = new RegExp(- protocol +- "(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]).)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9/])$"+ `${protocol}(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]).)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9/])$`);return validIP.test(this.url) || validHostname.test(this.url);},serverValid() {const protocol = "^(https?:\\/\\/)?";const validIP = new RegExp(- protocol +- "(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]).){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$"+ `${protocol}(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]).){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$`);const validHostname = new RegExp(- protocol +- "(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]).)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9/])$"+ `${protocol}(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]).)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9/])$`);return validIP.test(this.server) || validHostname.test(this.server);}diff --git a/pages/settings.vue b/pages/settings.vueindex 5b4e13bf2..f09131f8a 100644--- a/pages/settings.vue+++ b/pages/settings.vue@@ -398,9 +398,9 @@ export default {firebase.auth().signInWithPopup(provider)- .then(res => {- if (res.additionalUserInfo.isNewUser) {- this.$toast.info(this.$t("turn_on") + " " + this.$t("sync"), {+ .then(({ additionalUserInfo }) => {+ if (additionalUserInfo.isNewUser) {+ this.$toast.info(`${this.$t("turn_on")} ${this.$t("sync")}`, {icon: "sync",duration: null,closeOnSwipe: false,@@ -427,9 +427,9 @@ export default {firebase.auth().signInWithPopup(provider)- .then(res => {- if (res.additionalUserInfo.isNewUser) {- this.$toast.info(this.$t("turn_on") + " " + this.$t("sync"), {+ .then(({ additionalUserInfo }) => {+ if (additionalUserInfo.isNewUser) {+ this.$toast.info(`${this.$t("turn_on")} ${this.$t("sync")}`, {icon: "sync",duration: null,closeOnSwipe: false,@@ -458,14 +458,14 @@ export default {fb.writeSettings("syncHistory", true);fb.writeSettings("syncCollections", false);},- resetProxy(e) {+ resetProxy({ target }) {this.settings.PROXY_URL = `https://postwoman.apollotv.xyz/`;- e.target.innerHTML = this.doneButton;+ target.innerHTML = this.doneButton;this.$toast.info(this.$t("cleared"), {icon: "clear_all"});setTimeout(- () => (e.target.innerHTML = '<i class="material-icons">clear_all</i>'),+ () => (target.innerHTML = '<i class="material-icons">clear_all</i>'),1000);}