v4.7.0
- Add the ability to use fetch or any custom fetcher instead of Axios. It will make future SDK bundles smaller in size and allow better integration with other JavaScript libraries and frameworks.
These improvement to the SDK may require some adjustments in projects using it. Especially the ones which extend the SDK with custom endpoints. Still, these adjustments should be small. For example, we changed the options required by the Http
class from { host: string }
to { fetcher: Fetcher }
so whatever mechanism is used to communicate with Spree - Axios, fetch or something else, it's shared between all endpoint groups. Axios is still the default mechanism and included in the browser bundle. The Client
class and makeClient
function now accept two additional options: fetcherType: 'axios' | 'fetch' | 'custom'
and createFetcher: CreateFetcher
. Switching to the 'fetch'
fetcherType
requires installing node-fetch
in Node. If you want to use a different fetch
implementation in Node use the custom
option and create a custom fetcher using createCustomizedFetchFetcher
.