2022-03-17 15:00:17 +00:00
|
|
|
// DON'T TOUCH THIS
|
|
|
|
// These are separate clients and do not share configs between themselves
|
|
|
|
import { ApolloClient, InMemoryCache } from "@apollo/client";
|
|
|
|
import { createFetch, createSaleorClient } from "@saleor/sdk";
|
|
|
|
import { createUploadLink } from "apollo-upload-client";
|
|
|
|
|
|
|
|
import { API_URI } from "../config";
|
|
|
|
import introspectionQueryResultData from "./fragmentTypes.generated";
|
|
|
|
import { TypedTypePolicies } from "./typePolicies.generated";
|
|
|
|
|
|
|
|
export const link = createUploadLink({
|
|
|
|
credentials: "include",
|
|
|
|
uri: API_URI,
|
2022-06-21 09:36:55 +00:00
|
|
|
fetch: createFetch(),
|
2022-03-17 15:00:17 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
export const apolloClient = new ApolloClient({
|
|
|
|
cache: new InMemoryCache({
|
|
|
|
possibleTypes: introspectionQueryResultData.possibleTypes,
|
|
|
|
typePolicies: {
|
|
|
|
CountryDisplay: {
|
2022-06-21 09:36:55 +00:00
|
|
|
keyFields: ["code"],
|
2022-03-17 15:00:17 +00:00
|
|
|
},
|
|
|
|
Money: {
|
2022-06-21 09:36:55 +00:00
|
|
|
merge: false,
|
2022-03-17 15:00:17 +00:00
|
|
|
},
|
|
|
|
TaxedMoney: {
|
2022-06-21 09:36:55 +00:00
|
|
|
merge: false,
|
2022-03-17 15:00:17 +00:00
|
|
|
},
|
|
|
|
Weight: {
|
2022-06-21 09:36:55 +00:00
|
|
|
merge: false,
|
2022-03-17 15:00:17 +00:00
|
|
|
},
|
|
|
|
Shop: {
|
2022-06-21 09:36:55 +00:00
|
|
|
keyFields: [],
|
|
|
|
},
|
|
|
|
} as TypedTypePolicies,
|
2022-03-17 15:00:17 +00:00
|
|
|
}),
|
2022-06-21 09:36:55 +00:00
|
|
|
link,
|
2022-03-17 15:00:17 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
export const saleorClient = createSaleorClient({
|
|
|
|
apiUrl: API_URI,
|
2022-06-21 09:36:55 +00:00
|
|
|
channel: "",
|
2022-03-17 15:00:17 +00:00
|
|
|
});
|