This commit is contained in:
Rizky 2024-07-30 08:48:45 +07:00
parent c572396ac8
commit b1088b537c
2 changed files with 50 additions and 45 deletions

File diff suppressed because one or more lines are too long

View File

@ -7,6 +7,8 @@ import { IMeta } from "../../vi/utils/types";
import { base } from "./base"; import { base } from "./base";
import { scanComponent } from "./component"; import { scanComponent } from "./component";
const cached = { route: null as any };
const getRoute = () => { const getRoute = () => {
return new Promise<{ return new Promise<{
site: any; site: any;
@ -16,6 +18,8 @@ const getRoute = () => {
}[]; }[];
layout: any; layout: any;
}>(async (done) => { }>(async (done) => {
if (cached.route) done(cached.route);
let is_done = false; let is_done = false;
let res = await fetch(base.url`_prasi/route`); let res = await fetch(base.url`_prasi/route`);
@ -23,7 +27,8 @@ const getRoute = () => {
if (!res.headers.get("content-encoding")) { if (!res.headers.get("content-encoding")) {
fetch(base.url`_prasi/compress/only-gz`); fetch(base.url`_prasi/compress/only-gz`);
} }
done(await res.json()); cached.route = await res.json();
done(cached.route);
} }
}); });
}; };