Files
resolutionflow/frontend/src/api/auth.ts
Michael Chihlas cd10ecd42c Complete Phase 2: Frontend implementation with React + TypeScript
Frontend Features:
- React 18 + Vite + TypeScript + Tailwind CSS + Zustand
- JWT authentication with automatic token refresh
- Tree library with search and category filtering
- Full tree navigation (decision/action/solution nodes)
- Session management with notes and completion
- Session history with export (Markdown/Text/HTML)
- ErrorBoundary for graceful error handling

Backend Fixes:
- CORS: Added port 5174 to allowed origins
- Sessions: Fixed JSONB datetime serialization (mode='json')

Documentation:
- Updated PROGRESS.md with Phase 2 completion
- Updated 03-DEVELOPMENT-ROADMAP.md with checked items
- Added PHASE-2.5-PERSONAL-BRANCHING.md spec

Seed Data:
- Added backend/scripts/seed_data.py with Password Reset tree

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 22:42:22 -05:00

36 lines
947 B
TypeScript

import apiClient from './client'
import type { Token, User, UserCreate, UserLogin } from '@/types'
export const authApi = {
async register(data: UserCreate): Promise<User> {
const response = await apiClient.post<User>('/auth/register', data)
return response.data
},
async login(data: UserLogin): Promise<Token> {
const response = await apiClient.post<Token>('/auth/login/json', data)
return response.data
},
async refresh(): Promise<Token> {
const refreshToken = localStorage.getItem('refresh_token')
const response = await apiClient.post<Token>('/auth/refresh', null, {
headers: {
Authorization: `Bearer ${refreshToken}`,
},
})
return response.data
},
async me(): Promise<User> {
const response = await apiClient.get<User>('/auth/me')
return response.data
},
async logout(): Promise<void> {
await apiClient.post('/auth/logout')
},
}
export default authApi