feat(medusa-react): Add medusaClient prop to MedusaProvider (#6299)
This commit is contained in:
@@ -99,6 +99,10 @@ export interface MedusaProviderProps {
|
|||||||
* @defaultValue `{}`
|
* @defaultValue `{}`
|
||||||
*/
|
*/
|
||||||
customHeaders?: Record<string, any>
|
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,
|
customHeaders,
|
||||||
maxRetries = 3,
|
maxRetries = 3,
|
||||||
children,
|
children,
|
||||||
}: MedusaProviderProps) => {
|
medusaClient = new Medusa({
|
||||||
const medusaClient = new Medusa({
|
|
||||||
baseUrl,
|
baseUrl,
|
||||||
maxRetries,
|
maxRetries,
|
||||||
apiKey,
|
apiKey,
|
||||||
publishableApiKey,
|
publishableApiKey,
|
||||||
customHeaders,
|
customHeaders,
|
||||||
})
|
}),
|
||||||
|
}: MedusaProviderProps) => {
|
||||||
return (
|
return (
|
||||||
<QueryClientProvider {...queryClientProviderProps}>
|
<QueryClientProvider {...queryClientProviderProps}>
|
||||||
<MedusaContext.Provider
|
<MedusaContext.Provider
|
||||||
|
|||||||
Reference in New Issue
Block a user