Refactor index.vue to use Network Strategies

This commit is contained in:
Andrew Bastin
2020-01-13 23:48:20 -05:00
parent 3726f0a376
commit 5ef1b5b75c

View File

@@ -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();