Skip to content

Commit

Permalink
Merge pull request #543 from liyasthomas/refactor
Browse files Browse the repository at this point in the history
Refactor
  • Loading branch information
jamesgeorge007 committed Feb 1, 2020
2 parents f9008df + 0f55b8e commit 4c62baa
Show file tree
Hide file tree
Showing 6 changed files with 118 additions and 158 deletions.
11 changes: 5 additions & 6 deletions components/ace-editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
Expand All @@ -76,11 +76,10 @@ export default {
defineTheme() {
if (this.theme) {
return this.theme;
} else {
return (
this.$store.state.postwoman.settings.THEME_ACE_EDITOR || DEFAULT_THEME
);
}
return (
this.$store.state.postwoman.settings.THEME_ACE_EDITOR || DEFAULT_THEME
);
}
},
Expand Down
4 changes: 2 additions & 2 deletions pages/doc.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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"), {
Expand Down
16 changes: 8 additions & 8 deletions pages/graphql.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 4c62baa

Please sign in to comment.