multica/apps/web/shared/api/index.ts
Naiyuan Qing f70b34a50f fix: resolve merge conflicts with main, preserve PAT functionality
- Resolve conflicts in CLAUDE.md, client.ts, settings/page.tsx
- Migrate PAT types and API methods to @/shared/types + @/shared/api architecture
- Restore simplified login flow (login page, auth store, tests)
- Fix issue detail comment submit test (use fireEvent + useRef for mock)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 17:19:24 +08:00

23 lines
671 B
TypeScript

import { createLogger } from "@/shared/logger";
import { ApiClient } from "./client";
export { ApiClient } from "./client";
export type { LoginResponse } from "./client";
export { WSClient } from "./ws-client";
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL ?? "http://localhost:8080";
export const api = new ApiClient(API_BASE_URL, { logger: createLogger("api") });
// Initialize token from localStorage on load
if (typeof window !== "undefined") {
const token = localStorage.getItem("multica_token");
if (token) {
api.setToken(token);
}
const wsId = localStorage.getItem("multica_workspace_id");
if (wsId) {
api.setWorkspaceId(wsId);
}
}