Skip to content

Commit effa2ef

Browse files
committed
Setup users mocks pagination
1 parent 8602e49 commit effa2ef

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/_api/_mocks/usersMocks.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,16 @@ export default {
77
...usersData.current,
88
})
99

10-
mock.onGet('/users').reply(200, {
11-
users: [...usersData.list],
12-
count: usersData.list.length,
10+
mock.onGet('/users').reply(config => {
11+
const { limit = 10, offset = 0 } = config.params
12+
13+
return [
14+
200,
15+
{
16+
users: usersData.list.slice(offset, offset + limit),
17+
count: usersData.list.length,
18+
},
19+
]
1320
})
1421

1522
//

0 commit comments

Comments
 (0)