Add complete API integration for ProjectManagement module: - Epics, Stories, Tasks API clients - React Query hooks for all entities - Updated type definitions to match backend API - API test page for connection verification Changes: - Update lib/api/config.ts: Add all ProjectManagement endpoints - Update types/project.ts: Match backend API models (Epic, Story, Task) - Create lib/api/pm.ts: API clients for Epics, Stories, Tasks - Create lib/hooks/use-epics.ts: React Query hooks for Epic CRUD - Create lib/hooks/use-stories.ts: React Query hooks for Story CRUD - Create lib/hooks/use-tasks.ts: React Query hooks for Task CRUD - Create app/(dashboard)/api-test/page.tsx: API connection test page Features: - Full CRUD operations for Epics, Stories, Tasks - Status change and assignment operations - Optimistic updates for better UX - Error handling with toast notifications - Query invalidation for cache consistency 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
42 lines
1.3 KiB
TypeScript
42 lines
1.3 KiB
TypeScript
export const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:5167';
|
|
|
|
export const API_ENDPOINTS = {
|
|
// Auth
|
|
LOGIN: '/api/auth/login',
|
|
REGISTER_TENANT: '/api/auth/register-tenant',
|
|
REFRESH_TOKEN: '/api/auth/refresh',
|
|
LOGOUT: '/api/auth/logout',
|
|
ME: '/api/auth/me',
|
|
|
|
// Users
|
|
USERS: '/api/users',
|
|
USER_PROFILE: (userId: string) => `/api/users/${userId}`,
|
|
|
|
// Tenants
|
|
TENANT_USERS: (tenantId: string) => `/api/tenants/${tenantId}/users`,
|
|
ASSIGN_ROLE: (tenantId: string, userId: string) =>
|
|
`/api/tenants/${tenantId}/users/${userId}/role`,
|
|
|
|
// Projects
|
|
PROJECTS: '/api/v1/projects',
|
|
PROJECT: (id: string) => `/api/v1/projects/${id}`,
|
|
|
|
// Epics
|
|
EPICS: '/api/v1/epics',
|
|
EPIC: (id: string) => `/api/v1/epics/${id}`,
|
|
EPIC_STATUS: (id: string) => `/api/v1/epics/${id}/status`,
|
|
EPIC_ASSIGN: (id: string) => `/api/v1/epics/${id}/assign`,
|
|
|
|
// Stories
|
|
STORIES: '/api/v1/stories',
|
|
STORY: (id: string) => `/api/v1/stories/${id}`,
|
|
STORY_STATUS: (id: string) => `/api/v1/stories/${id}/status`,
|
|
STORY_ASSIGN: (id: string) => `/api/v1/stories/${id}/assign`,
|
|
|
|
// Tasks
|
|
TASKS: '/api/v1/tasks',
|
|
TASK: (id: string) => `/api/v1/tasks/${id}`,
|
|
TASK_STATUS: (id: string) => `/api/v1/tasks/${id}/status`,
|
|
TASK_ASSIGN: (id: string) => `/api/v1/tasks/${id}/assign`,
|
|
};
|