Frontend API structure.

This commit is contained in:
Drew 2025-09-22 02:00:26 -07:00
parent 7d2b7fc90c
commit c443a13a14
10 changed files with 1810 additions and 4 deletions

View file

@ -75,14 +75,14 @@ captains-log/
## Phase 2: Core API Integration (Days 3-4)
### Task 2.1: Define TypeScript Types
- [ ] **File**: `frontend/src/types/task.ts`
- [x] **File**: `frontend/src/types/task.ts`
- Create Task interface matching backend TaskModel
- Add TaskStatus enum (Todo, Done, Backlog)
- Include API response types and error types
- **Expected outcome**: Type definitions compile without errors
### Task 2.2: Backend API Client
- [ ] **File**: `frontend/src/services/api.ts`
- [x] **File**: `frontend/src/services/api.ts`
- Implement API client with fetch wrapper
- Add all task endpoints: GET, POST, PUT, DELETE /api/tasks
- Include error handling and response parsing
@ -90,7 +90,7 @@ captains-log/
- **Expected outcome**: API client can communicate with backend
### Task 2.3: Custom React Hooks for API
- [ ] **Files**: `frontend/src/hooks/useTask.ts`, `frontend/src/hooks/useTasks.ts`
- [x] **Files**: `frontend/src/hooks/useTask.ts`, `frontend/src/hooks/useTasks.ts`
- Create useTask hook for single task operations (get, update, delete)
- Create useTasks hook for task list operations (list, create)
- Include loading states, error handling, and optimistic updates
@ -98,7 +98,7 @@ captains-log/
- **Expected outcome**: Hooks provide clean API for components
### Task 2.4: API Integration Tests
- [ ] **File**: `frontend/tests/api.test.ts`
- [x] **File**: `frontend/tests/api.test.ts`
- Test API client with mock responses
- Test custom hooks with mock API calls
- Test error handling scenarios