ADORSYS-GIS / ADORSYS-GIS/webank-UserApp

Refactor: Eliminate Repetitive Patterns in Request Service

Abierto
#338 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
5
Forks
0
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

### Description

### **Description:**

The `requestService.ts` file currently includes a lot of repetitive logic — particularly around:

* Retrieving key pairs via `KeyManagement()`
* Generating JWTs using `generateJWT()`
* Passing the same sequence of arguments to API service calls

This task aims to **reduce boilerplate code**, **improve readability**, and **make the request layer easier to maintain and scale**. `(middleware ?? )`

### **Acceptance Criteria:**

* [ ] Repeated key-pair and JWT logic is abstracted or modularized
* [ ] Refactor all request functions
* [ ] No change in API contract or behavior
* [ ] Code is easier to extend and reason about
* [ ] Clear documentation or inline comments are added where appropriate

### Subtasks:

1. **Audit Existing Duplications**

* Identify repeated patterns in `KeyManagement()`, `generateJWT()`, and API call structure

2. **Define an Abstraction Approach**

* Decide whether to use a helper function, wrapper, or service class
* (Optional) Create a small utility module for reuse

3. **Ensure Backward Compatibility**

* Test the refactored functions to ensure they work exactly as before

4. **Cleanup & Comment**

* Remove redundant code
* Add brief comments or docs for any new abstraction created

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.