Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

Remove dependency on history component to add history entry

Andrew Bastin9e602394cfbd
diff --git a/components/history/index.vue b/components/history/index.vue
index 0b2b6ae0e..0a588f952 100644
--- a/components/history/index.vue
+++ b/components/history/index.vue
@@ -98,8 +98,6 @@ import {
clearGraphqlHistory,
toggleGraphqlHistoryEntryStar,
toggleRESTHistoryEntryStar,
- addGraphqlHistoryEntry,
- addRESTHistoryEntry,
deleteGraphqlHistoryEntry,
deleteRESTHistoryEntry
} from "~/newstore/history"
@@ -155,10 +153,6 @@ export default {
icon: "delete",
})
},
- addEntry(entry) {
- if (this.page === "rest") addRESTHistoryEntry(entry)
- else addGraphqlHistoryEntry(entry)
- },
enableHistoryClearing() {
if (!this.history || !this.history.length) return
this.isClearingHistory = true
diff --git a/pages/graphql.vue b/pages/graphql.vue
index 4b328bbd5..4a575ed12 100644
--- a/pages/graphql.vue
+++ b/pages/graphql.vue
@@ -481,6 +481,7 @@ import { commonHeaders } from "~/helpers/headers"
import { getPlatformSpecialKey } from "~/helpers/platformutils"
import { sendNetworkRequest } from "~/helpers/network"
import { getSettingSubject } from "~/newstore/settings"
+import { addGraphqlHistoryEntry } from "~/newstore/history"
export default {
beforeRouteLeave(_to, _from, next) {
@@ -852,8 +853,7 @@ export default {
duration,
}
- // TODO: Use history store system mechanism instead!
- this.$refs.graphqlHistoryComponent.addEntry(entry)
+ addGraphqlHistoryEntry(entry)
} catch (error) {
this.response = `${error}. ${this.$t("check_console_details")}`
this.$nuxt.$loading.finish()
diff --git a/pages/index.vue b/pages/index.vue
index da19e8021..32978c690 100644
--- a/pages/index.vue
+++ b/pages/index.vue
@@ -669,6 +669,7 @@ import { httpValid } from "~/helpers/utils/valid"
import { knownContentTypes, isJSONContentType } from "~/helpers/utils/contenttypes"
import { generateCodeWithGenerator } from "~/helpers/codegen/codegen"
import { getSettingSubject, applySetting } from "~/newstore/settings"
+import { addRESTHistoryEntry } from "~/newstore/history"
import clone from "lodash/clone"
export default {
@@ -1409,8 +1410,7 @@ export default {
entry.url = parseTemplateString(entry.url, environmentVariables)
}
- // TODO: Use the history store mechanism instead!
- this.$refs.historyComponent.addEntry(entry)
+ addRESTHistoryEntry(entry)
})()
} catch (error) {
this.runningRequest = false
@@ -1465,8 +1465,7 @@ export default {
entry.url = parseTemplateString(entry.url, environmentVariables)
}
- // TODO: Use the history state mechanism instead!
- this.$refs.historyComponent.addEntry(entry)
+ addRESTHistoryEntry(entry)
return
} else {
this.response.status = error.message