Files
aiot-uniapp/src/service/listAll.ts
feige996 7b37bccd98 feat(请求): 添加请求取消功能并修改示例页面
在 listAll 服务中添加延迟以测试取消功能
在示例页面添加取消按钮并修改请求方法
2025-09-23 18:24:40 +08:00

21 lines
528 B
TypeScript

/* eslint-disable */
// @ts-ignore
import request from '@/http/vue-query';
import { CustomRequestOptions } from '@/http/types';
import * as API from './types';
const sleep = (ms: number) => new Promise(resolve => setTimeout(resolve, ms));
/** 用户列表 GET /user/listAll */
export async function listAllUsingGet({
options,
}: {
options?: CustomRequestOptions;
}) {
await sleep(2000); // 方便测试 cancel 功能
return request<API.UserItem[]>('/user/listAll', {
method: 'GET',
...(options || {}),
});
}