ADORSYS-GIS / ADORSYS-GIS/webank-UserApp

Refactor: Eliminate Repetitive Patterns in Request Service

未關閉
#338 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
TypeScript
星號
5
分支
0
PR 合併指標
30 天內沒有已合併 PR

描述

### 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

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。