2016-06-17 13:48:33 +00:00
|
|
|
import { get } from '../api/client';
|
|
|
|
|
|
|
|
|
|
import { ADMIN_API } from '../config/wagtail';
|
|
|
|
|
|
|
|
|
|
export const getChildPages = (id, options = {}) => {
|
|
|
|
|
let url = `${ADMIN_API.PAGES}?child_of=${id}`;
|
|
|
|
|
|
|
|
|
|
if (options.fields) {
|
|
|
|
|
url += `&fields=${global.encodeURIComponent(options.fields.join(','))}`;
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-09 15:52:07 +00:00
|
|
|
// Only show pages that have children for now
|
|
|
|
|
url += `&has_children=1`;
|
2016-06-17 13:48:33 +00:00
|
|
|
|
|
|
|
|
return get(url).then(res => res.body);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const getPage = (id) => {
|
|
|
|
|
const url = `${ADMIN_API.PAGES}${id}/`;
|
|
|
|
|
|
|
|
|
|
return get(url).then(res => res.body);
|
|
|
|
|
};
|