globalbrain / sefirot

Global Brain Design System.
https://sefirot.globalbrains.com
MIT License
151 stars 12 forks source link

feat(http): allow overriding fetch handler #435

Closed brc-dd closed 9 months ago

brc-dd commented 9 months ago

Bit of a breaking change:

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

Http.config({
  baseURL: '/foo'
})
netlify[bot] commented 9 months ago

Deploy Preview for sefirot-story ready!

Name Link
Latest commit 655bce1004499bdaf15628474e3de1b0fe016071
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.

netlify[bot] commented 9 months ago

Deploy Preview for sefirot-docs ready!

Name Link
Latest commit 655bce1004499bdaf15628474e3de1b0fe016071
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.

kiaking commented 9 months ago

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

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

Http.config({
  base: '...',
  xsrfUrl: false,
  $fetch: ... // when necessary?
})
cuebit commented 9 months ago

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

@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 commented 9 months ago

updated