ZBD | 7e88c22 | 2025-05-07 21:07:12 +0800 | [diff] [blame] | 1 | import { rest } from 'msw'; |
2 | |||||
3 | export const handlers = [ | ||||
4 | rest.get('/api/resources', (req, res, ctx) => { | ||||
5 | return res(ctx.json([ | ||||
6 | { id: 1, title: 'Ubuntu 22.04 ISO', description: 'Linux 镜像' } | ||||
7 | ])); | ||||
8 | }), | ||||
9 | |||||
10 | rest.get('/api/user/123', (req, res, ctx) => { | ||||
11 | return res(ctx.json({ | ||||
12 | id: 123, | ||||
13 | name: 'Test User', | ||||
14 | avatar: 'https://example.com/avatar.jpg' | ||||
15 | })); | ||||
16 | }), | ||||
17 | ]; |