Skip to main content
api is a small wrapper around a preconfigured axios instance. It points at https://api.csknapps.xyz/api, attaches the user’s credentials to every request, and resolves with the response body.

Credentials

You do not set headers yourself.
  • In a shell, useBridgeAuth stores the token from the bridge, and every request carries Authorization: Bearer <token>.
  • In a signed-in browser, useBridgeAuth switches the base URL to your own origin’s /api proxy, which reads the session cookie and forwards it.
Requests sent before useBridgeAuth reports isReady go out without credentials. Gate authenticated queries on it.

Errors

api.* rejects with the axios error. The status and body are on error.response:
For AI endpoints, use aiCreditsExhausted(error) to recognize “out of credits”.

Raw instance

apiClient is the underlying axios instance, for interceptors or anything api does not cover: