Я использую Mirage для создания поддельных данных.
сценарий/default.js
export default function(server) {
server.createList('product', 48);
server.loadFixtures();
}
Выше я создаю 48 продуктов и звоню с контроллера
this.store.query('product', {
filter: {
limit: 10,
offset: 0
}
}).then((result) => {
console.log(result);
});
и в mirage/config.js
this.get('/products', function(db) {
let products = db.products;
return {
data: products.map(attrs => ({
type: 'product',
id: attrs.id,
attributes: attrs
}))
};
});
теперь мой вопрос, как загрузить 10 продуктов на страницу? Я отправляю фильтр 10, так как размер страницы и смещение означают номер страницы.
какие изменения нужно внести в config.js, чтобы загружать только ограниченные продукты?