Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(medusa-react): Add medusaClient as an input to MedusaProvider #6299

Conversation

erikengervall
Copy link
Contributor

What - what changes are in this PR

Adds an optional medusaClient to MedusaProvider

Updates the access modifier for the axiosClient within the request module for medusa-js.

Why - why are these changes relevant

Our project currently has an extended medusaClient which has an overwritten axiosClient under the hood. This axiosClient has some interceptors that help us manage our responses and errors in a unified way and it works great for all of our custom endpoints.

The issue is with calls that are made via custom hooks via medusa-js. These calls are made by a different medusaClient and there's no way for us to provide our custom one to the MedusaProvider so that ours is used throughout the app.

How - how have the changes been implemented

Added a field to allow for passing in a medusaClient of choice.

Testing - how has the changes been tested or how can the reviewer test the feature

Not sure how one goes about firing up any service within the monorepo to test this properly, but TypeScript seems happy with the update.

@erikengervall erikengervall requested review from a team as code owners February 1, 2024 12:31
Copy link

changeset-bot bot commented Feb 1, 2024

⚠️ No Changeset found

Latest commit: a741d45

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Feb 1, 2024

@erikengervall is attempting to deploy a commit to the medusajs Team on Vercel.

A member of the Team first needs to authorize it.

@erikengervall erikengervall force-pushed the feat/add-medusa-as-argument-to-medusa-provider- branch from 4b2cec7 to a741d45 Compare February 1, 2024 12:32
Copy link
Contributor

@olivermrbl olivermrbl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, will let @kasperkristensen approve too :)

Copy link
Contributor

@kasperkristensen kasperkristensen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

vercel bot commented Feb 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
medusa-dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 5, 2024 8:58am
2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
docs-ui ⬜️ Ignored (Inspect) Visit Preview Feb 5, 2024 8:58am
medusa-docs ⬜️ Ignored (Inspect) Visit Preview Feb 5, 2024 8:58am

@olivermrbl olivermrbl merged commit b1276cf into medusajs:develop Feb 5, 2024
14 of 17 checks passed
@erikengervall erikengervall deleted the feat/add-medusa-as-argument-to-medusa-provider- branch February 8, 2024 06:26
@nicolama-dev
Copy link

is there a release scheduled soon of medusa-react to enjoy this feature? I was in the same case as you. It would be very helpful. Thanks.

@olivermrbl
Copy link
Contributor

@nicolama-dev, this PR was missing a changeset, so it didn't land in the previous release.

We've cut a new one this morning. Please try medusa-react@9.0.15 and let me know :)

@nicolama-dev
Copy link

thanks Oli - looks good. Are you planning to add the withCredentials settings in the medusaClient? Now that the Bearer auth is live it would be great to have the possibility to set that to false.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants