Skip to content

feat(auth): add phone/password login flow and simplify env example

Lakshy Yarlagadda requested to merge feat/authlogin into main
## Summary
Adds a simple authentication flow using Corpus login (`POST /api/v1/auth/login`) and gates the dashboard behind login. Also simplifies `.env.example` to only required config.

## What changed
- Added login UI (phone + password) and login request in `src/App.tsx`.
- Stores/reuses `access_token` in localStorage (`corpus_access_token`).
- Configures corpus service with logged-in token.
- Added logout action and auth-gated rendering (login page vs dashboard).
- Updated intern search to send `Authorization: Bearer <token>` from session in:
  - `src/components/intern/InternSearch.tsx`
- Updated Vite proxy token behavior in `vite.config.ts`:
  - Uses `.env` fallback token only when request has no auth header.
  - Skips fallback token injection for `/api/v1/auth/*` routes.
- Simplified `.env.example` to:
  - `SWECHA_API_BASE_URL=https://api.corpus.swecha.org`
- Added minimal auth page styles in `src/styles.css`.

## Files changed
- `.env.example`
- `src/App.tsx`
- `src/components/intern/InternSearch.tsx`
- `src/styles.css`
- `vite.config.ts`

## Validation
- `npm run build` passed successfully.

Merge request reports

Loading