
* Add createGraphQLClient util to shared package * Update urql version and use createGraphQLClient from shared package * Update urql version and use createGraphQLClient from shared package - data importer * Update urql version and use createGraphQLClient from shared package - cms * Update CRM * Update invoices * Update klaviyo * Update slack * Update products feed * Update search * Remove unused urql next * Update monitoring * Update taxes * Remove multipart since no longer used * Update the lockfile * Removed urql introspection since none of our apps used it * Add changeset
17 lines
525 B
TypeScript
17 lines
525 B
TypeScript
import { useAppBridge } from "@saleor/app-sdk/app-bridge";
|
|
import { createGraphQLClient } from "@saleor/apps-shared";
|
|
import { PropsWithChildren } from "react";
|
|
import { Provider } from "urql";
|
|
|
|
export function GraphQLProvider(props: PropsWithChildren<{}>) {
|
|
const { appBridgeState } = useAppBridge();
|
|
const saleorApiUrl = appBridgeState?.saleorApiUrl!;
|
|
const token = appBridgeState?.token!;
|
|
|
|
const client = createGraphQLClient({
|
|
saleorApiUrl,
|
|
token,
|
|
});
|
|
|
|
return <Provider value={client} {...props} />;
|
|
}
|