Skip to content

Commit

Permalink
feat(medusa-react): Add medusaClient prop to MedusaProvider (#6299)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikengervall authored Feb 5, 2024
1 parent e2738ab commit b1276cf
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/medusa-react/src/contexts/medusa.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

/**
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b1276cf

Please sign in to comment.