Fix Vite proxy inside Docker and add success pages
- vite.config.ts: proxy target via VITE_API_TARGET env var (falls back to localhost) - docker-compose.dev.yml: set VITE_API_TARGET=http://backend:8000 - Add /login-success and /register-success placeholder pages - Show real API error messages in login/register forms Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
# 2026-04-12 — Fix Vite proxy and add success pages
|
||||
|
||||
**Timestamp:** 2026-04-12T16:00:00
|
||||
|
||||
## Summary
|
||||
|
||||
Fixed login/registration failures caused by wrong Vite proxy target inside Docker. Added login and registration success pages. Improved error messages to show actual API responses.
|
||||
|
||||
## Root Cause
|
||||
|
||||
Vite's dev server proxy was targeting `http://localhost:8000`. Inside the Docker network, `localhost` resolves to the frontend container itself (not the backend). The correct target inside Docker is `http://backend:8000` (Docker service name).
|
||||
|
||||
## Files Modified
|
||||
|
||||
- `frontend/vite.config.ts` — proxy target now reads from `process.env.VITE_API_TARGET`, falling back to `http://localhost:8000` for local dev without Docker
|
||||
- `docker-compose.dev.yml` — added `VITE_API_TARGET: http://backend:8000` to frontend environment
|
||||
- `frontend/src/App.tsx` — added `/login-success` and `/register-success` routes
|
||||
- `frontend/src/hooks/useAuth.ts` — redirects to `/login-success` after login
|
||||
- `frontend/src/pages/LoginPage.tsx` — parses real API error from response instead of generic message
|
||||
- `frontend/src/pages/RegisterPage.tsx` — redirects to `/register-success` on success; shows real API validation errors
|
||||
|
||||
## Files Added
|
||||
|
||||
- `frontend/src/pages/LoginSuccessPage.tsx` — placeholder: "Login successful"
|
||||
- `frontend/src/pages/RegisterSuccessPage.tsx` — placeholder: "Registration successful" with link to sign in
|
||||
Reference in New Issue
Block a user