saleor-apps-redis_apl/apps/taxes/src/providers/GraphQLProvider.tsx
Krzysztof Wolski a1ad70e879
Unify urql version, use shared util to create client (#657)
* 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
2023-06-19 15:59:27 +02:00

20 lines
562 B
TypeScript

import { useAppBridge } from "@saleor/app-sdk/app-bridge";
import { PropsWithChildren } from "react";
import { Provider } from "urql";
import { createGraphQLClient } from "@saleor/apps-shared";
export function GraphQLProvider(props: PropsWithChildren<{}>) {
const { appBridgeState } = useAppBridge();
if (!appBridgeState?.saleorApiUrl) {
return <div {...props}></div>;
}
const client = createGraphQLClient({
saleorApiUrl: appBridgeState.saleorApiUrl,
token: appBridgeState.token,
});
return <Provider value={client} {...props} />;
}