localhost_oa_front/mocks/list.ts

29 lines
835 B
TypeScript
Raw Permalink Normal View History

2024-02-27 17:22:27 +08:00
import { http, HttpResponse, delay } from 'msw';
import { faker } from '@faker-js/faker/locale/zh_CN';
import { serverApi } from './_util';
export default [
http.get(serverApi('/list'), async () => {
await delay(1000);
return HttpResponse.json(
Array.from({ length: 10 }).map(() => ({
fullname: faker.person.fullName(),
email: faker.internet.email(),
avatar: faker.image.avatar(),
address: faker.location.streetAddress(),
})),
);
}),
http.get(serverApi('/list'), async () => {
await delay(1000);
return HttpResponse.json(
Array.from({ length: 10 }).map(() => ({
fullname: faker.person.fullName(),
email: faker.internet.email(),
avatar: faker.image.avatar(),
address: faker.location.streetAddress(),
})),
);
}),
];