fix(medusa-react): Allow setting maxRetries on MedusaProvider (#5765)
* allow settign maxRetries on MedusaProvider * add changeset * set default maxRetries to 3
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"medusa-react": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix(medusa-react): Allow setting maxRetries on MedusaProvider
|
||||||
@@ -32,6 +32,11 @@ interface MedusaProviderProps {
|
|||||||
* available within the request
|
* available within the request
|
||||||
*/
|
*/
|
||||||
publishableApiKey?: string
|
publishableApiKey?: string
|
||||||
|
/**
|
||||||
|
* Number of times to retry a request if it fails
|
||||||
|
* @default 3
|
||||||
|
*/
|
||||||
|
maxRetries?: number
|
||||||
customHeaders?: Record<string, any>
|
customHeaders?: Record<string, any>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,14 +46,15 @@ export const MedusaProvider = ({
|
|||||||
apiKey,
|
apiKey,
|
||||||
publishableApiKey,
|
publishableApiKey,
|
||||||
customHeaders,
|
customHeaders,
|
||||||
|
maxRetries = 3,
|
||||||
children,
|
children,
|
||||||
}: MedusaProviderProps) => {
|
}: MedusaProviderProps) => {
|
||||||
const medusaClient = new Medusa({
|
const medusaClient = new Medusa({
|
||||||
baseUrl,
|
baseUrl,
|
||||||
maxRetries: 0,
|
maxRetries,
|
||||||
apiKey,
|
apiKey,
|
||||||
publishableApiKey,
|
publishableApiKey,
|
||||||
customHeaders
|
customHeaders,
|
||||||
})
|
})
|
||||||
return (
|
return (
|
||||||
<QueryClientProvider {...queryClientProviderProps}>
|
<QueryClientProvider {...queryClientProviderProps}>
|
||||||
|
|||||||
Reference in New Issue
Block a user