This commit is contained in:
Rizky 2024-04-01 13:44:00 +07:00
parent 55d1d7376b
commit fe47485e28
1 changed files with 12 additions and 15 deletions

View File

@ -35,7 +35,7 @@ export const _ = {
}, },
route: async () => { route: async () => {
if (gz) { if (gz) {
if (cache.route) return cache.route; if (cache.route) return await responseCompressed(req, cache.route);
let layout = null as null | SinglePage; let layout = null as null | SinglePage;
for (const l of gz.layouts) { for (const l of gz.layouts) {
@ -43,21 +43,18 @@ export const _ = {
if (l.is_default_layout) layout = l; if (l.is_default_layout) layout = l;
} }
cache.route = await responseCompressed( cache.route = JSON.stringify({
req, site: { ...gz.site, api_url: (gz.site as any)?.config?.api_url },
JSON.stringify({ urls: gz.pages.map((e) => {
site: { ...gz.site, api_url: (gz.site as any)?.config?.api_url }, return { id: e.id, url: e.url };
urls: gz.pages.map((e) => { }),
return { id: e.id, url: e.url }; layout: {
}), id: layout?.id,
layout: { root: layout?.content_tree,
id: layout?.id, },
root: layout?.content_tree, });
},
})
);
return cache.route; return await responseCompressed(req, cache.route);
} }
}, },
page: async () => { page: async () => {