Skip to content

HTTP Client

The shared client handles tokens, response envelopes, error conversion, 401 logout, idempotent retries, request deduplication, route-change cancellation, user prompts, multipart conversion, and multiple backend origins.

ts
await http.post<CreateResult>({
  url: '/api/orders',
  data: form,
  showLoading: true,
  loadingType: 'fullscreen',
  showSuccessMessage: true,
  dedup: true,
  cancelOnRouteChange: true,
  retries: 0,
})

Set cancelOnRouteChange: false for long-running tasks that must survive navigation, dedup: false for intentionally identical parallel operations, and responseType: 'blob' for downloads. Only retry writes when the backend implements an idempotency key.

Released under the MIT License