Skip to content

Commit

Permalink
fix: GraphtonSettings now uses static properties instead of a floatin…
Browse files Browse the repository at this point in the history
…g const

BREAKING-CHANGE: Use GraphtonSettings.headers and GraphtonSettings.graphqlEndpoint instead of GraphtonSettings.setDefaultHeaders and GraphtonSettings.setDefaultUrl
  • Loading branch information
Roboroads committed Jul 10, 2022
1 parent 30787dd commit 7b532fa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions src/stubs/GraphtonBaseQuery.stub.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { GraphtonEnum } from './GraphtonBaseEnum.stub';
const settings = {
defaultHeaders: {},
defaultUrl: ''
};
import { GraphtonSettings } from "./Settings.stub";
/*ENDIGNORE*/
import axios from 'axios';
export class GraphtonBaseQuery {
Expand Down Expand Up @@ -35,10 +32,10 @@ export class GraphtonBaseQuery {
* Execute the query
*/
async execute(requestOptions = {}) {
const response = await axios.post(requestOptions?.url || settings.defaultUrl, { query: this.toQuery() }, {
const response = await axios.post(requestOptions?.url || GraphtonSettings.graphqlEndpoint, { query: this.toQuery() }, {
headers: {
'Content-Type': 'application/json',
...settings.defaultHeaders,
...GraphtonSettings.headers,
...requestOptions?.headers
},
});
Expand Down
2 changes: 1 addition & 1 deletion src/stubs/Settings.stub.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export declare class GraphtonSettings {
static headers: {};
static headers: Record<string, string>;
static graphqlEndpoint: string;
}

0 comments on commit 7b532fa

Please sign in to comment.