Skip to content

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

Refactor index.vue to use Network Strategies

Andrew Bastin5ef1b5b75c2f
diff --git a/pages/index.vue b/pages/index.vue
index 422b6ade5..9f61a3d6e 100644
--- a/pages/index.vue
+++ b/pages/index.vue
@@ -1128,6 +1128,7 @@ import getEnvironmentVariablesFromScript from "../functions/preRequest";
import parseTemplateString from "../functions/templating";
import AceEditor from "../components/ace-editor";
import { tokenRequest, oauthRedirect } from "../assets/js/oauth";
+import { sendNetworkRequest } from "../functions/network";
const statusCategories = [
{
@@ -1985,20 +1986,8 @@ export default {
if (typeof requestOptions.data === "string") {
requestOptions.data = parseTemplateString(requestOptions.data);
}
- const config = this.$store.state.postwoman.settings.PROXY_ENABLED
- ? {
- method: "POST",
- url:
- this.$store.state.postwoman.settings.PROXY_URL ||
- "https://postwoman.apollotv.xyz/",
- data: requestOptions
- }
- : requestOptions;
- const response = await this.$axios(config);
- return this.$store.state.postwoman.settings.PROXY_ENABLED
- ? response.data
- : response;
+ return await sendNetworkRequest(requestOptions, this.$store);
},
async sendRequest() {
this.$toast.clear();