feat(medusa-react): Add medusaClient prop to MedusaProvider (#6299)

This commit is contained in:
Erik Engervall
2024-02-05 17:56:57 +09:00
committed by GitHub
parent e2738ab91d
commit b1276cfcd5

View File

@@ -99,6 +99,10 @@ export interface MedusaProviderProps {
* @defaultValue `{}`
*/
customHeaders?: Record<string, any>
/**
* An instance of the Medusa JS Client. If you don't provide an instance, one will be created using the `baseUrl`, `apiKey`, `publishableApiKey`, `maxRetries`, and `customHeaders` props.
*/
medusaClient: Medusa
}
/**
@@ -144,14 +148,14 @@ export const MedusaProvider = ({
customHeaders,
maxRetries = 3,
children,
}: MedusaProviderProps) => {
const medusaClient = new Medusa({
medusaClient = new Medusa({
baseUrl,
maxRetries,
apiKey,
publishableApiKey,
customHeaders,
})
}),
}: MedusaProviderProps) => {
return (
<QueryClientProvider {...queryClientProviderProps}>
<MedusaContext.Provider