
* Update eslint config to prevent default exports * exlucde vitest config from banned default exports * Remove default exports from Monitoring App * Replace default exports with named exports * Fix klaviyo import path * Replace default exports in CMS
16 lines
517 B
TypeScript
16 lines
517 B
TypeScript
import { useAppBridge } from "@saleor/app-sdk/app-bridge";
|
|
import { PropsWithChildren } from "react";
|
|
import { Provider } from "urql";
|
|
import { createClient } from "./lib/create-graphq-client";
|
|
|
|
export function GraphQLProvider(props: PropsWithChildren<{}>) {
|
|
const { appBridgeState } = useAppBridge();
|
|
|
|
const client = createClient(
|
|
`/graphql`,
|
|
async () => Promise.resolve({ token: appBridgeState?.token! }),
|
|
() => appBridgeState?.saleorApiUrl!
|
|
);
|
|
|
|
return <Provider value={client} {...props} />;
|
|
}
|