mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-12-08 09:15:59 +08:00
refactor(request): unify response transformation methods and deprecate transformBackendResponse
This commit is contained in:
@@ -116,7 +116,7 @@ export function createRequest<ResponseData, ApiData, State extends Record<string
|
||||
const responseType = response.config?.responseType || 'json';
|
||||
|
||||
if (responseType === 'json') {
|
||||
return opts.transformBackendResponse(response);
|
||||
return opts.transform(response);
|
||||
}
|
||||
|
||||
return response.data as MappedType<R, T>;
|
||||
@@ -152,7 +152,7 @@ export function createFlatRequest<ResponseData, ApiData, State extends Record<st
|
||||
const responseType = response.config?.responseType || 'json';
|
||||
|
||||
if (responseType === 'json') {
|
||||
const data = await opts.transformBackendResponse(response);
|
||||
const data = await opts.transform(response);
|
||||
|
||||
return { data, error: null, response };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user