mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
18 lines
529 B
JavaScript
18 lines
529 B
JavaScript
|
var api = require('../../api');
|
||
|
|
||
|
function fetchData(options) {
|
||
|
return api.settings.read('postsPerPage').then(function then(response) {
|
||
|
var postPP = response.settings[0],
|
||
|
postsPerPage = parseInt(postPP.value, 10);
|
||
|
|
||
|
// No negative posts per page, must be number
|
||
|
if (!isNaN(postsPerPage) && postsPerPage > 0) {
|
||
|
options.limit = postsPerPage;
|
||
|
}
|
||
|
options.include = 'author,tags,fields';
|
||
|
return api.posts.browse(options);
|
||
|
});
|
||
|
}
|
||
|
|
||
|
module.exports = fetchData;
|