saleor-apps-redis_apl/apps/monitoring/src/graphql-provider.tsx
Lukasz Ostrowski eca52ad058
Replace export default with named exports (#352)
* 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
2023-04-05 20:27:23 +02:00

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} />;
}