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,9 +43,7 @@ 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,
JSON.stringify({
site: { ...gz.site, api_url: (gz.site as any)?.config?.api_url }, site: { ...gz.site, api_url: (gz.site as any)?.config?.api_url },
urls: gz.pages.map((e) => { urls: gz.pages.map((e) => {
return { id: e.id, url: e.url }; return { id: e.id, url: e.url };
@ -54,10 +52,9 @@ export const _ = {
id: layout?.id, id: layout?.id,
root: layout?.content_tree, root: layout?.content_tree,
}, },
}) });
);
return cache.route; return await responseCompressed(req, cache.route);
} }
}, },
page: async () => { page: async () => {