refactor(projects): 请求适配器函数范型重构、优化请求相关的命名

This commit is contained in:
Soybean
2022-07-28 13:19:50 +08:00
parent 02992dc02d
commit 7f9c98ab8d
11 changed files with 77 additions and 54 deletions

View File

@@ -1,11 +1,11 @@
import { serviceAdapter } from '@/utils';
import { adapter } from '@/utils';
import { request, mockRequest } from '../request';
import { adapterOfFetchDataWithAdapter } from '../adapter';
import { adapterOfFetchDataWithAdapter } from './demo.adapter';
/** 带有适配器的请求(将请求结果进行数据处理) */
/** 带有适配器的请求示例 */
export async function fetchDataWithAdapter() {
const res = await mockRequest.post<ApiDemo.DataWithAdapter>('/apiDemoWithAdapter');
return serviceAdapter(adapterOfFetchDataWithAdapter, res);
return adapter(adapterOfFetchDataWithAdapter, res);
}
/** 测试代理后的请求 */