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(http): allow overriding fetch handler #435

Merged
merged 4 commits into from
Jan 12, 2024
Merged

feat(http): allow overriding fetch handler #435

merged 4 commits into from
Jan 12, 2024

Conversation

brc-dd
Copy link
Member

@brc-dd brc-dd commented Jan 10, 2024

Bit of a breaking change:

// earlier -- Http.base = '/foo' -- now:

Http.config({
  baseURL: '/foo'
})

Copy link

netlify bot commented Jan 10, 2024

Deploy Preview for sefirot-story ready!

Name Link
🔨 Latest commit 655bce1
🔍 Latest deploy log https://app.netlify.com/sites/sefirot-story/deploys/659f91d73008c00008b615fa
😎 Deploy Preview https://deploy-preview-435--sefirot-story.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Jan 10, 2024

Deploy Preview for sefirot-docs ready!

Name Link
🔨 Latest commit 655bce1
🔍 Latest deploy log https://app.netlify.com/sites/sefirot-docs/deploys/659f91d761a8990008dbc23e
😎 Deploy Preview https://deploy-preview-435--sefirot-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@brc-dd brc-dd requested a review from kiaking January 10, 2024 14:22
@kiaking
Copy link
Member

kiaking commented Jan 10, 2024

I think it would be cooler if we can hide ofetch beneath Http 🤔 How about we add config method?

Http.config({
  base: '...',
  xsrfUrl: false
})

@brc-dd
Copy link
Member Author

brc-dd commented Jan 10, 2024

Ah, but need to replace ofetch entirely in nuxt. Maybe this: ?

Http.config({
  base: '...',
  xsrfUrl: false,
  $fetch: ... // when necessary?
})

@cuebit
Copy link
Member

cuebit commented Jan 10, 2024

Ah, but need to replace ofetch entirely in nuxt. Maybe this: ?

Http.config({

  base: '...',

  xsrfUrl: false,

  $fetch: ... // when necessary?

})

Yea this makes more sense. Probably ideal to allow passing an implementation than conditional operation where dependencies are concerned.

@kiaking
Copy link
Member

kiaking commented Jan 10, 2024

@brc-dd

Ah, but need to replace ofetch entirely in nuxt. Maybe this: ?

Oh sorry I was missing that 😳 Yeah I think your example make sense. Maybe name it client ? (so that we could switch to even something else

@brc-dd brc-dd marked this pull request as draft January 10, 2024 16:25
@brc-dd brc-dd marked this pull request as ready for review January 10, 2024 16:59
@brc-dd
Copy link
Member Author

brc-dd commented Jan 10, 2024

updated

Copy link
Member

@kiaking kiaking left a comment

Choose a reason for hiding this comment

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

Nice! Looking smooth 👍

@kiaking kiaking merged commit 74fe7f9 into main Jan 12, 2024
9 checks passed
@kiaking kiaking deleted the override-fetch branch January 12, 2024 05:57
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.

None yet

3 participants