refactor(request): unify response transformation methods and deprecate transformBackendResponse

This commit is contained in:
Soybean
2025-07-19 12:04:00 +08:00
parent 936b834e62
commit f83eefbc3e
4 changed files with 20 additions and 5 deletions

View File

@@ -22,7 +22,7 @@ export const request = createFlatRequest(
errMsgStack: [],
refreshTokenPromise: null
} as RequestInstanceState,
transformBackendResponse(response: AxiosResponse<App.Service.Response<any>>) {
transform(response: AxiosResponse<App.Service.Response<any>>) {
return response.data.data;
},
async onRequest(config) {
@@ -132,7 +132,7 @@ export const demoRequest = createRequest(
baseURL: otherBaseURL.demo
},
{
transformBackendResponse(response: AxiosResponse<App.Service.DemoResponse>) {
transform(response: AxiosResponse<App.Service.DemoResponse>) {
return response.data.result;
},
async onRequest(config) {