Merge pull request #322 from AndrewBastin/feat/gql_proxy
GraphQL introspection requests now support and respect proxying
This commit is contained in:
@@ -175,11 +175,36 @@ export default {
|
|||||||
this.$nuxt.$loading.start();
|
this.$nuxt.$loading.start();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await axios.post(this.url, {
|
|
||||||
|
const query = JSON.stringify({
|
||||||
query: gql.getIntrospectionQuery()
|
query: gql.getIntrospectionQuery()
|
||||||
});
|
});
|
||||||
|
|
||||||
const schema = gql.buildClientSchema(res.data.data);
|
const reqOptions = {
|
||||||
|
method: "post",
|
||||||
|
url: this.url,
|
||||||
|
headers: {
|
||||||
|
"content-type": "application/json"
|
||||||
|
},
|
||||||
|
data: query
|
||||||
|
}
|
||||||
|
|
||||||
|
const reqConfig = this.$store.state.postwoman.settings.PROXY_ENABLED
|
||||||
|
? {
|
||||||
|
method: "post",
|
||||||
|
url: `https://postwoman.apollotv.xyz/`,
|
||||||
|
data: reqOptions
|
||||||
|
}
|
||||||
|
: reqOptions;
|
||||||
|
|
||||||
|
|
||||||
|
const res = await axios(reqConfig);
|
||||||
|
|
||||||
|
const data = this.$store.state.postwoman.settings.PROXY_ENABLED
|
||||||
|
? res.data
|
||||||
|
: res;
|
||||||
|
|
||||||
|
const schema = gql.buildClientSchema(data.data.data);
|
||||||
this.schemaString = gql.printSchema(schema, {
|
this.schemaString = gql.printSchema(schema, {
|
||||||
commentDescriptions: true
|
commentDescriptions: true
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user