mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-23 06:15:49 +00:00
24 lines
522 B
JavaScript
24 lines
522 B
JavaScript
|
|
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(','))}`;
|
||
|
|
}
|
||
|
|
|
||
|
|
if (options.filter) {
|
||
|
|
url += `&${options.filter}`;
|
||
|
|
}
|
||
|
|
|
||
|
|
return get(url).then(res => res.body);
|
||
|
|
};
|
||
|
|
|
||
|
|
export const getPage = (id) => {
|
||
|
|
const url = `${ADMIN_API.PAGES}${id}/`;
|
||
|
|
|
||
|
|
return get(url).then(res => res.body);
|
||
|
|
};
|