- Create centralized config module (apps/web/src/lib/config.ts) exporting: - API_BASE_URL: Main API server URL from NEXT_PUBLIC_API_URL - ORCHESTRATOR_URL: Orchestrator service URL from NEXT_PUBLIC_ORCHESTRATOR_URL - Helper functions for building full URLs - Update client.ts to import from central config - Update LoginButton.tsx to use API_BASE_URL from config - Update useWebSocket.ts to use API_BASE_URL from config - Update AgentStatusWidget.tsx to use ORCHESTRATOR_URL from config - Update TaskProgressWidget.tsx to use ORCHESTRATOR_URL from config - Update useGraphData.ts to use API_BASE_URL from config - Fixed wrong default port (was 8000, now uses correct 3001) - Add comprehensive tests for config module - Update useWebSocket tests to properly mock config module Refs #338 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
19 lines
531 B
TypeScript
19 lines
531 B
TypeScript
"use client";
|
|
|
|
import { Button } from "@mosaic/ui";
|
|
import { API_BASE_URL } from "@/lib/config";
|
|
|
|
export function LoginButton(): React.JSX.Element {
|
|
const handleLogin = (): void => {
|
|
// Redirect to the backend OIDC authentication endpoint
|
|
// BetterAuth will handle the OIDC flow and redirect back to the callback
|
|
window.location.assign(`${API_BASE_URL}/auth/signin/authentik`);
|
|
};
|
|
|
|
return (
|
|
<Button variant="primary" onClick={handleLogin} className="w-full">
|
|
Sign In with Authentik
|
|
</Button>
|
|
);
|
|
}
|