Overview
Mates ships thin HTTP helpers on top of fetch: Get, Post, Put, Patch, Delete, and generic Fetch. Each returns a cancellable ZeroPromise.
Every helper takes a single FetchInput — a URL string or a FetchRequest (url/path, host, params, body, headers, …). Path tokens like :id are filled from params; remaining keys become the query string.
Shared host, interceptors, and getAction factories live on FetchClient.
Helpers vs client
|
Approach
|
Best for
|
Notes
|
|---|---|---|
Get('/users')
| One-off | Default global client — scripts and simple pages. |
FetchClient / useUtils()
| App / module | Shared host + interceptors — see FetchClient. |
asyncAction / *Action
| UI data | Reactive loading / error / data atoms around the same helpers. |
Live Get()
Real GET against JSONPlaceholder. Helpers return ZeroPromise — await like a Promise.
Path params
url: '/todos/:id' + params: { id } substitutes the path token.