GitBook's API is sending id instead of uid now

This commit is contained in:
Shrikant Sharat Kandula 2022-07-14 12:36:52 +05:30 committed by GitHub
parent c331f8c330
commit bc71311c8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -82,7 +82,7 @@ function pushChildPages(masterPage) {
page.path = (masterPage.path || masterPage.ref) + "/" + page.path;
pushChildPages(page);
page.pages = undefined;
pages[page.uid] = page;
pages[page.id] = page;
});
}
}
@ -146,11 +146,11 @@ exports.handler = async (event, context, callback) => {
getAllPages(Object.keys(pages)).then(updatedPages => {
// console.log("fetched all pages ", Object.keys(pages));
updatedPages.forEach((page, index) => {
// console.log("update page fullpath", page.uid);
page.path = pages[page.uid].path;
// console.log("update page fullpath", page.id);
page.path = pages[page.id].path;
delete page.pages;
page.objectID = page.uid;
delete page.uid;
page.objectID = page.id;
delete page.id;
});
updatedPages.sort((pageA, pageB) => {
const orderA = orderMap[pageA.path] || 999;