1.7 KiB
1.7 KiB
Task 2 Report: API Layer Creation
Files Created
All 9 API files were successfully created in frontend/src/api/:
| File | Description | Exports |
|---|---|---|
index.js |
Axios instance with interceptors | default request |
auth.js |
Auth API (login, getCurrentUser) | authApi |
materials.js |
Materials API (CRUD + upload) | materialsApi |
inbound.js |
Inbound API (CRUD) | inboundApi |
outbound.js |
Outbound API (CRUD) | outboundApi |
stock.js |
Stock API (list, warning, logs) | stockApi |
application.js |
Application API (create, getMy, getAll, cancel, approve, reject) | applicationApi |
logs.js |
Logs API | logsApi |
users.js |
Users API (CRUD) | usersApi |
Syntax Validation
All files passed syntax validation with import/export checks.
API Endpoints Summary
- Auth: POST
/auth/login, GET/auth/me - Materials: GET/POST
/materials, GET/PUT/DELETE/materials/:id, POST/upload - Inbound: GET/POST
/inbound, GET/PUT/DELETE/inbound/:id - Outbound: GET/POST
/outbound, GET/PUT/DELETE/outbound/:id - Stock: GET
/stock, GET/stock/warning, GET/stock/logs/:materialId - Applications: POST
/applications, GET/applications/my, GET/applications, POST/applications/:id/cancel, POST/applications/:id/approve, POST/applications/:id/reject - Logs: GET
/logs - Users: GET/POST
/users, PUT/DELETE/users/:id
Configuration
- Base URL:
/api(proxied through Vite tolocalhost:8080) - Timeout: 30000ms
- Auth token automatically added via request interceptor from
localStorage.wmms_token - 401 responses automatically clear token and redirect to
/login
Status
COMPLETED - All files created and validated.