feat: add mindmap components from jarvis frontend
- Copied mindmap visualization components (ReactFlow-based interactive graph) - Added MindmapViewer, ReactFlowEditor, MermaidViewer - Included all node types: Concept, Task, Idea, Project - Added controls: NodeCreateModal, ExportButton - Created mindmap route at /mindmap - Added useGraphData hook for knowledge graph API - Copied auth-client and api utilities (dependencies) Note: Requires better-auth packages to be installed for full compilation
This commit is contained in:
33
apps/web/src/lib/api.ts
Normal file
33
apps/web/src/lib/api.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* API utilities for session management and authentication
|
||||
*/
|
||||
|
||||
let sessionExpiredHandled = false;
|
||||
|
||||
/**
|
||||
* Handle session expiration by redirecting to login
|
||||
*/
|
||||
export function handleSessionExpired(): void {
|
||||
if (sessionExpiredHandled) return;
|
||||
sessionExpiredHandled = true;
|
||||
|
||||
// If we're in the browser, redirect to login
|
||||
if (typeof window !== 'undefined') {
|
||||
window.location.href = '/login?expired=true';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a session expiration is already being handled
|
||||
* (prevents multiple simultaneous redirects)
|
||||
*/
|
||||
export function isSessionExpiring(): boolean {
|
||||
return sessionExpiredHandled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the session expiration flag (for testing)
|
||||
*/
|
||||
export function resetSessionExpirationFlag(): void {
|
||||
sessionExpiredHandled = false;
|
||||
}
|
||||
Reference in New Issue
Block a user