mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-09-29 07:56:37 +08:00
1.4 KiB
1.4 KiB
VITE FRONTEND (src) KNOWLEDGE BASE
OVERVIEW
React app entry + routing + providers. This is where UI architecture decisions live.
STRUCTURE
vite-frontend/src/
├── main.tsx # ReactDOM + BrowserRouter + Provider
├── provider.tsx # HeroUI + theme + toaster + i18n wrapper
├── App.tsx # Routes + ProtectedRoute + H5 layout selection
├── api/ # Axios wrapper + typed endpoint helpers
├── pages/ # Route views (large)
├── layouts/ # Admin/H5 page chrome
├── components/ # Shared UI components
├── utils/ # JWT parsing + auth helpers + WebView utilities
└── styles/ # globals.css
WHERE TO LOOK
| Task | Location | Notes |
|---|---|---|
| Route definitions | vite-frontend/src/App.tsx |
React Router v6 |
| API client baseURL | vite-frontend/src/api/network.ts |
/api/v1/ + token header |
| Token decoding | vite-frontend/src/utils/jwt.ts |
Checks exp vs now |
| Role checks | vite-frontend/src/utils/auth.ts |
isAdmin() is role_id == 0 |
| WebView integration | vite-frontend/src/api/network.ts |
Panel address selection in WebView mode |
CONVENTIONS
- Token is stored in
localStorage.tokenand sent asAuthorizationheader (raw token string). - H5 mode detection is in
vite-frontend/src/App.tsx(screen/user-agent/query paramh5=true).
COMMANDS
cd vite-frontend
npm run dev
npm run lint