Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for multi-store M2 backends #28

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export const host = process.env.M2_CONFIG_HOST;
export const graphQlHost = `${host}/graphql`;
export const store = process.env.M2_CONFIG_STORE;
4 changes: 2 additions & 2 deletions src/fetchWithGraphQl.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fetch from 'isomorphic-unfetch';
import { graphQlHost } from './config';
import { store, graphQlHost } from './config';
import GraphQlQuery from './types/GraphQlQuery';

function fetchWithGraphQl(query: GraphQlQuery, token: string | null = null): Promise<any> {
Expand All @@ -12,7 +12,7 @@ function fetchWithGraphQl(query: GraphQlQuery, token: string | null = null): Pro
...authHeaders,
Accept: 'application/json',
'Content-Type': 'application/json',
Store: 'default',
Store: store,
acrois marked this conversation as resolved.
Show resolved Hide resolved
},
body: JSON.stringify(query),
}).then((res) => res.json());
Expand Down