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: allow fetch override on client #701

Closed
wants to merge 1 commit into from

Conversation

juliusmarminge
Copy link
Collaborator

@juliusmarminge juliusmarminge commented Mar 10, 2024

quickly spun up the ability to allow fetch override to set headers. Ref: https://discord.com/channels/966627436387266600/1102510616326967306/1216240077605310576

Questions

  • do we need full fetch override? or is headers enough? or both?
  • currently only possible to set on the genUploader, generateReactHelpers, generateUploadButton etc etc. Maybe we should also have a way to allow this override when doing the call / on the components? Thinking if the token requires React context?
const { token } = useUser();
const { startUpload } = useUploadThing({
  headers: {
    Authorization: `Bearer ${token}`
  }
})
  • is it even useful at all to have it on the generators? Maybe it should just be on individual calls

Copy link

changeset-bot bot commented Mar 10, 2024

⚠️ No Changeset found

Latest commit: c75b458

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 Mar 10, 2024

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

Name Status Preview Updated (UTC)
docs-uploadthing ✅ Ready (Inspect) Visit Preview Mar 10, 2024 10:04am

Copy link
Contributor

A new canary is available for testing. You can install this latest build in your project with:

pnpm add @uploadthing/[email protected]
pnpm add @uploadthing/[email protected]
pnpm add @uploadthing/[email protected]
pnpm add @uploadthing/[email protected]
pnpm add @uploadthing/[email protected]
pnpm add [email protected]

@github-actions github-actions bot removed the release canary Trigger a canary release to npm label Mar 10, 2024
@markflorkowski
Copy link
Collaborator

do we need full fetch override? or is headers enough? or both?

I can't really think of reasons why you would actually need a full fetch override, headers only is probably fine. IF other things are needed in the future we can reassess.

is it even useful at all to have it on the generators?

Probably not. I think having it on the hook/components is probably more flexible for the user.

@juliusmarminge
Copy link
Collaborator Author

Superseded by #705

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

Successfully merging this pull request may close these issues.

2 participants