spree/spree-api-v2-js-sdk

Option to use fetch instead of axios

tniezg opened this issue · 1 comments

Is your feature request related to a problem? Please describe.

fetch (native or polyfilled) is already common in many NodeJS and front-end projects. It will be useful to reuse existing fetch instead of requiring axios in the SDK.

Describe the solution you'd like.

Require axios by default but allow configuring the SDK's client to use fetch instead. If fetch is configured and not available, throw an error. Allow providing a specific fetch implementation instead of global or require('fetch').

Describe alternatives you've considered.

Leaving axios as the only option. axios is a popular package. But having the ability to switch can decrease the bundle size of the entire project and provide fetch responses which the project already handles.

Additional context

-