Module exposing: isUnauthorizedError, timeoutMessage, api, login, checkAuth, UNAUTHORIZED, API_TIMEOUT_MS, makeTimeoutSignal
// Source: https://github.com/gossipcat-ai/gossipcat-ai | License: MIT | Copyright 2026 Ataberk Yavuzer
// Provided via justclaw.it.com; keep this notice with the code.
const BASE = '/dashboard/api';
/**
* Message thrown by api() on an HTTP 401. Exported so the data layer can tell a
* dead-session 401 apart from a generic fetch failure and trigger an auth
* re-check (issue #548 item 3b) instead of showing an error card forever.
*/
export const UNAUTHORIZED = 'unauthorized';
/** True if `err` is the 401 sentinel from api(), even after endpoint-wrapping. */
export function isUnauthorizedError(err: unknown): boolean {
return err instanceof Error && err.message.includes(UNAUTHORIZED);
}
/** Default abort timeout for polled api() calls (milliseconds). */
export const API_TIMEOUT_MS = 3
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key