2019-10-01 12:19:10 +00:00
|
|
|
const common = require('./common')
|
|
|
|
|
|
|
|
exports.getAllArticlesPagination = function(options) {
|
|
|
|
let extra = ''
|
|
|
|
|
|
|
|
if (options.sort) {
|
|
|
|
extra += '&sort=' + options.sort
|
|
|
|
}
|
|
|
|
if (options.per_page) {
|
|
|
|
extra += '&perPage=' + options.per_page
|
|
|
|
}
|
|
|
|
if (options.page) {
|
|
|
|
extra += '&page=' + options.page
|
|
|
|
}
|
|
|
|
if (options.includes) {
|
|
|
|
extra += '&includes=' + options.includes.join(',')
|
|
|
|
}
|
|
|
|
|
2019-10-02 00:16:11 +00:00
|
|
|
return '/api/articles/public?' + extra
|
2019-10-01 12:19:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
exports.getAllPageArticlesPagination = function(pageId, options) {
|
|
|
|
let extra = ''
|
|
|
|
|
|
|
|
if (options.sort) {
|
|
|
|
extra += '&sort=' + options.sort
|
|
|
|
}
|
|
|
|
if (options.per_page) {
|
|
|
|
extra += '&perPage=' + options.per_page
|
|
|
|
}
|
|
|
|
if (options.page) {
|
|
|
|
extra += '&page=' + options.page
|
|
|
|
}
|
|
|
|
if (options.includes) {
|
|
|
|
extra += '&includes=' + options.includes.join(',')
|
|
|
|
}
|
|
|
|
|
2019-10-02 00:16:11 +00:00
|
|
|
return '/api/pages/' + pageId + '/articles/public?' + extra
|
2019-10-01 12:19:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
exports.getArticle = function(id) {
|
|
|
|
return common.sendRequest({
|
|
|
|
method: 'GET',
|
2019-10-02 00:16:11 +00:00
|
|
|
url: '/api/articles/public/' + id + '?includes=media,parent,banner,files',
|
2019-10-01 12:19:10 +00:00
|
|
|
})
|
|
|
|
}
|