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,
useBridgeAuthstores the token from the bridge, and every request carriesAuthorization: Bearer <token>. - In a signed-in browser,
useBridgeAuthswitches the base URL to your own origin’s/apiproxy, which reads the session cookie and forwards it.
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:
aiCreditsExhausted(error) to recognize “out of credits”.
Raw instance
apiClient is the underlying axios instance, for interceptors or anything api does not cover: