github elbywan/wretch 2.8.1

latest releases: 2.11.0, 2.10.0, 2.9.1...
8 months ago

2.8.1 (2024-03-07)

🐛 Bug fix(es)

  • Fix error callback type missing addons extensions (99a21a8), closes #222
export const apiClient = wretch('https://localhost:3000')
  .addon(QueryStringAddon)
  .resolve((chain) => {
    return chain.unauthorized((_error, request) => {
      // request type used to be wrong (missing .query() from the addon)
      // and it would clash with what was expected by the callback definition
      // now the type should be correct ✨ 
      return request
        .fetch()
        .unauthorized((error) => {
          throw error;
        })
        .json();
    });
  });

⬆️ Version update(s)

  • Bump follow-redirects from 1.15.1 to 1.15.4 (04fada6)

Don't miss a new wretch release

NewReleases is sending notifications on new releases.