fix(api): 修改接口支持异步函数和普通函数,支持返回Promise,增强请求处理

This commit is contained in:
liaochunxin
2025-09-23 15:36:33 +08:00
parent 5b1c001a52
commit bc6dcdde93
2 changed files with 30 additions and 6 deletions

View File

@@ -21,8 +21,8 @@ export interface IFooItem {
}
/** GET 请求 */
export function getFooAPI(name: string) {
return http.get<IFooItem>('/foo', { name })
export async function getFooAPI(name: string) {
return await http.get<IFooItem>('/foo', { name })
}
/** GET 请求;支持 传递 header 的范例 */
export function getFooAPI2(name: string) {