pingdotgg / uploadthing

File uploads for modern web devs
https://uploadthing.com
MIT License
4k stars 293 forks source link

feat: allow fetch override on client #701

Closed juliusmarminge closed 6 months ago

juliusmarminge commented 6 months ago

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

Questions

const { token } = useUser();
const { startUpload } = useUploadThing({
  headers: {
    Authorization: `Bearer ${token}`
  }
})
changeset-bot[bot] commented 6 months ago

⚠️ No Changeset found

Latest commit: c75b45887615269405e08e40dd737449042d7e4f

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

vercel[bot] commented 6 months ago

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
github-actions[bot] commented 6 months ago

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

pnpm add @uploadthing/dropzone@0.2.2-canary.eefdb6c
pnpm add @uploadthing/mime-types@0.2.7-canary.eefdb6c
pnpm add @uploadthing/react@6.3.5-canary.eefdb6c
pnpm add @uploadthing/shared@6.3.5-canary.eefdb6c
pnpm add @uploadthing/solid@6.2.2-canary.eefdb6c
pnpm add uploadthing@6.5.3-canary.eefdb6c
markflorkowski commented 6 months ago

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 commented 6 months ago

Superseded by #705