ADORSYS-GIS / ADORSYS-GIS/webank-UserApp
Refactor API Service Layer with Axios Client and Domain-Based Services
- Lingua principale
- TypeScript
- Stelle
- 5
- Fork
- 0
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
### Description
### **Description:**
The current API layer uses raw Axios calls scattered across the codebase with repetitive headers, base URLs, and inconsistent error handling. This refactor introduces a centralized `apiClient` instance, domain-based service files (e.g., `authService`, `kycService`, `transactionService`, `recoveryService`), and prepares the system for improved maintainability, type safety, and scalability. `(middleware ?? )`
### **Acceptance Criteria:**
* [ ] A centralized Axios instance (`apiClient.ts`) is created with base URL and interceptors.
* [ ] All direct Axios calls are moved into domain-specific service files:
* `authService.ts`
* `kycService.ts`
* `transactionService.ts`
* `recoveryService.ts`
* [ ] OBS endpoints are handled via a separate Axios instance or configured `baseURL` override.
* [ ] Each service handles headers and responses in a clean, reusable format.
* [ ] Old API utility files are removed or marked as deprecated.
* [ ] Code is tested to ensure no regression in existing functionality.
### **Subtasks:**
1. **Create Axios Instance**
* Create PRS Axios Instance
* Create OBS Axios Instance
* Add global response interceptor for logging errors
2. **Refactor Auth Service**
* Move OTP and email verification logic to `authService.ts`
3. **Refactor KYC Service**
* Move KYC storage, retrieval, and status logic to `kycService.ts`
4. **Refactor Transaction Service**
* Move account balance, top-up, withdrawal, and transaction logic to `transactionService.ts`
5. **Refactor Recovery Service**
* Move recovery token and account cert logic to `recoveryService.ts`
6. **Update All Component Imports**
* Replace old Axios calls with the new service methods in relevant components/pages
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.