wip fix
This commit is contained in:
+8
-1
@@ -4,6 +4,9 @@ import { gzipAsync } from "utils/gzip";
|
|||||||
import { getContent } from "../server/prep-api-ts";
|
import { getContent } from "../server/prep-api-ts";
|
||||||
import mime from "mime";
|
import mime from "mime";
|
||||||
|
|
||||||
|
const cache = {
|
||||||
|
route: null as any,
|
||||||
|
};
|
||||||
export const _ = {
|
export const _ = {
|
||||||
url: "/_prasi/**",
|
url: "/_prasi/**",
|
||||||
async api() {
|
async api() {
|
||||||
@@ -32,13 +35,15 @@ export const _ = {
|
|||||||
},
|
},
|
||||||
route: async () => {
|
route: async () => {
|
||||||
if (gz) {
|
if (gz) {
|
||||||
|
if (cache.route) return 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) {
|
||||||
if (!layout) layout = l;
|
if (!layout) layout = l;
|
||||||
if (l.is_default_layout) layout = l;
|
if (l.is_default_layout) layout = l;
|
||||||
}
|
}
|
||||||
|
|
||||||
return await responseCompressed(
|
cache.route = await responseCompressed(
|
||||||
req,
|
req,
|
||||||
JSON.stringify({
|
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 },
|
||||||
@@ -51,6 +56,8 @@ export const _ = {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return cache.route;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
page: async () => {
|
page: async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user