fix
This commit is contained in:
parent
c572396ac8
commit
b1088b537c
File diff suppressed because one or more lines are too long
|
|
@ -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);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue