wip fix new site
This commit is contained in:
parent
9d3614abc8
commit
6ea7c5ae0b
|
|
@ -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")) {
|
||||
|
|
|
|||
|
|
@ -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 = {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue