From fe47485e280c1c1cbea54dc919979bacb14180c0 Mon Sep 17 00:00:00 2001 From: Rizky Date: Mon, 1 Apr 2024 13:44:00 +0700 Subject: [PATCH] fix --- pkgs/api/_prasi.ts | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/pkgs/api/_prasi.ts b/pkgs/api/_prasi.ts index dd42556..9a5fb3e 100644 --- a/pkgs/api/_prasi.ts +++ b/pkgs/api/_prasi.ts @@ -35,7 +35,7 @@ export const _ = { }, route: async () => { if (gz) { - if (cache.route) return cache.route; + if (cache.route) return await responseCompressed(req, cache.route); let layout = null as null | SinglePage; for (const l of gz.layouts) { @@ -43,21 +43,18 @@ export const _ = { if (l.is_default_layout) layout = l; } - cache.route = await responseCompressed( - req, - JSON.stringify({ - site: { ...gz.site, api_url: (gz.site as any)?.config?.api_url }, - urls: gz.pages.map((e) => { - return { id: e.id, url: e.url }; - }), - layout: { - id: layout?.id, - root: layout?.content_tree, - }, - }) - ); + cache.route = JSON.stringify({ + site: { ...gz.site, api_url: (gz.site as any)?.config?.api_url }, + urls: gz.pages.map((e) => { + return { id: e.id, url: e.url }; + }), + layout: { + id: layout?.id, + root: layout?.content_tree, + }, + }); - return cache.route; + return await responseCompressed(req, cache.route); } }, page: async () => {