diff --git a/pages/graphql.vue b/pages/graphql.vue index 233b16336..ab2b1990e 100644 --- a/pages/graphql.vue +++ b/pages/graphql.vue @@ -346,6 +346,14 @@ export default { doneButton: 'done', expandResponse: false, responseBodyMaxLines: 16, + + settings: { + SCROLL_INTO_ENABLED: + typeof this.$store.state.postwoman.settings.SCROLL_INTO_ENABLED !== + "undefined" + ? this.$store.state.postwoman.settings.SCROLL_INTO_ENABLED + : true, + } } }, @@ -417,7 +425,7 @@ export default { const rootTypeName = this.resolveRootType(type).name const target = document.getElementById(`type_${rootTypeName}`) - if (target && this.$store.state.postwoman.settings.SCROLL_INTO_ENABLED) { + if (target && this.settings.SCROLL_INTO_ENABLED) { target.scrollIntoView({ behavior: "smooth", }) @@ -472,7 +480,7 @@ export default { this.$nuxt.$loading.start() this.response = this.$t("loading") - this.$store.state.postwoman.settings.SCROLL_INTO_ENABLED && this.scrollInto("response") + this.settings.SCROLL_INTO_ENABLED && this.scrollInto("response") try { let headers = {} @@ -515,7 +523,7 @@ export default { async getSchema() { const startTime = Date.now() this.schema = this.$t("loading") - this.$store.state.postwoman.settings.SCROLL_INTO_ENABLED && this.scrollInto("schema") + this.settings.SCROLL_INTO_ENABLED && this.scrollInto("schema") // Start showing the loading bar as soon as possible. // The nuxt axios module will hide it when the request is made. diff --git a/pages/index.vue b/pages/index.vue index 15a9461d2..47ac184d5 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -1518,7 +1518,15 @@ export default { customMethod: false, files: [], filenames: "", - navigatorShare: navigator.share + navigatorShare: navigator.share, + + settings: { + SCROLL_INTO_ENABLED: + typeof this.$store.state.postwoman.settings.SCROLL_INTO_ENABLED !== + "undefined" + ? this.$store.state.postwoman.settings.SCROLL_INTO_ENABLED + : true + } }; }, watch: { @@ -2085,8 +2093,7 @@ export default { this.path = path; this.showPreRequestScript = usesScripts; this.preRequestScript = preRequestScript; - this.$store.state.postwoman.settings.SCROLL_INTO_ENABLED && - this.scrollInto("request"); + this.settings.SCROLL_INTO_ENABLED && this.scrollInto("request"); }, getVariablesFromPreRequestScript() { if (!this.preRequestScript) { @@ -2133,8 +2140,7 @@ export default { }, async sendRequest() { this.$toast.clear(); - this.$store.state.postwoman.settings.SCROLL_INTO_ENABLED && - this.scrollInto("response"); + this.settings.SCROLL_INTO_ENABLED && this.scrollInto("response"); if (!this.isValidURL) { this.$toast.error(this.$t("url_invalid_format"), {