wip fix
This commit is contained in:
parent
2301d94a0a
commit
c2ea5caba8
|
|
@ -28,6 +28,7 @@ export default page({
|
|||
})();
|
||||
return <Loading note="init" />;
|
||||
}
|
||||
|
||||
if (!edInitSync(p)) {
|
||||
return <Loading note="connecting-ws" />;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,51 +33,55 @@ export const edInitSync = (p: PG) => {
|
|||
p.user.id = "ab1390f5-40d5-448e-a8c3-84b0fb600930";
|
||||
p.user.username = "anonymous";
|
||||
}
|
||||
if (!params.page_id) {
|
||||
if (location.pathname.startsWith("/vi/")) {
|
||||
if (page.list.length === 0) {
|
||||
db.page
|
||||
.findMany({
|
||||
where: {
|
||||
id_site: params.site_id,
|
||||
is_deleted: false,
|
||||
is_default_layout: false,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
url: true,
|
||||
},
|
||||
})
|
||||
.then((list) => {
|
||||
page.list = list;
|
||||
edInitSync(p);
|
||||
});
|
||||
|
||||
return;
|
||||
} else {
|
||||
if (!page.route) {
|
||||
page.route = createRouter();
|
||||
for (const e of page.list) {
|
||||
page.route.insert(e.url, e);
|
||||
}
|
||||
}
|
||||
if (location.pathname.startsWith("/vi/")) {
|
||||
if (page.list.length === 0) {
|
||||
db.page
|
||||
.findMany({
|
||||
where: {
|
||||
id_site: params.site_id,
|
||||
is_deleted: false,
|
||||
is_default_layout: false,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
url: true,
|
||||
},
|
||||
})
|
||||
.then((list) => {
|
||||
page.list = list;
|
||||
edInitSync(p);
|
||||
});
|
||||
|
||||
const arrpath = location.pathname.split("/");
|
||||
const pathname = "/" + arrpath.slice(3).join("/");
|
||||
return;
|
||||
}
|
||||
if (!page.route) {
|
||||
page.route = createRouter();
|
||||
for (const e of page.list) {
|
||||
page.route.insert(e.url, e);
|
||||
}
|
||||
}
|
||||
|
||||
const res = page.route.lookup(pathname);
|
||||
if (res) {
|
||||
params.page_id = res.id;
|
||||
if (res.params) {
|
||||
for (const [k, v] of Object.entries(res.params)) {
|
||||
if (!["site_id", "page_id"].includes(k)) {
|
||||
params[k] = v;
|
||||
}
|
||||
const arrpath = location.pathname.split("/");
|
||||
const pathname = "/" + arrpath.slice(3).join("/");
|
||||
|
||||
if (!params.page_id) {
|
||||
const res = page.route.lookup(pathname);
|
||||
if (res) {
|
||||
params.page_id = res.id;
|
||||
if (res.params) {
|
||||
for (const [k, v] of Object.entries(res.params)) {
|
||||
if (!["site_id", "page_id"].includes(k)) {
|
||||
params[k] = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (location.pathname.startsWith("/ed")) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!params.page_id) {
|
||||
if (location.pathname.startsWith("/ed")) {
|
||||
if (!params.site_id) {
|
||||
db.page
|
||||
.findFirst({
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ export const ViPreview = (arg: { pathname: string }) => {
|
|||
_href = `${w.basepath}${_href}`;
|
||||
}
|
||||
if (
|
||||
location.hostname.split(".").length === 4 ||
|
||||
location.hostname === "prasi.app" ||
|
||||
location.hostname === "prasi.avolut.com" ||
|
||||
location.hostname.includes("ngrok") ||
|
||||
|
|
|
|||
Loading…
Reference in New Issue