wip fix new site

This commit is contained in:
Rizky 2024-01-29 10:25:47 +07:00
parent 9d3614abc8
commit 6ea7c5ae0b
3 changed files with 19 additions and 2 deletions

View File

@ -8,6 +8,7 @@ import { isLocalhost } from "../../utils/ui/is-localhost";
export default page({
url: "**",
component: ({}) => {
const p = useGlobal(EDGlobal, "EDITOR");
useEffect(() => {
if (localStorage.getItem("prasi-session")) {

View File

@ -9,6 +9,7 @@ import { registerMobile } from "./render/live/logic/mobile";
import { sworkerAddCache, sworkerRegister } from "./sworker-boot";
import { w } from "./utils/types/general";
const start = async () => {
const base = `${location.protocol}//${location.host}`;
let react = {

View File

@ -100,8 +100,23 @@ export const edInitSync = (p: PG) => {
},
select: { id: true, id_site: true },
})
.then((e) => {
if (e) location.href = `/ed/${e.id_site}/${e.id}`;
.then(async (e) => {
if (e) location.href = `/ed/${params.site_id}/${e.id}`;
else {
const res = await db.page.create({
data: {
content_tree: {
childs: [],
id: "root",
type: "root",
},
name: "home",
url: "/",
site: { connect: { id: params.site_id } },
},
});
if (res) location.href = `/ed/${params.site_id}/${res.id}`;
}
});
}
return false;