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({
|
export default page({
|
||||||
url: "**",
|
url: "**",
|
||||||
component: ({}) => {
|
component: ({}) => {
|
||||||
|
|
||||||
const p = useGlobal(EDGlobal, "EDITOR");
|
const p = useGlobal(EDGlobal, "EDITOR");
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (localStorage.getItem("prasi-session")) {
|
if (localStorage.getItem("prasi-session")) {
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import { registerMobile } from "./render/live/logic/mobile";
|
||||||
import { sworkerAddCache, sworkerRegister } from "./sworker-boot";
|
import { sworkerAddCache, sworkerRegister } from "./sworker-boot";
|
||||||
import { w } from "./utils/types/general";
|
import { w } from "./utils/types/general";
|
||||||
|
|
||||||
|
|
||||||
const start = async () => {
|
const start = async () => {
|
||||||
const base = `${location.protocol}//${location.host}`;
|
const base = `${location.protocol}//${location.host}`;
|
||||||
let react = {
|
let react = {
|
||||||
|
|
|
||||||
|
|
@ -100,8 +100,23 @@ export const edInitSync = (p: PG) => {
|
||||||
},
|
},
|
||||||
select: { id: true, id_site: true },
|
select: { id: true, id_site: true },
|
||||||
})
|
})
|
||||||
.then((e) => {
|
.then(async (e) => {
|
||||||
if (e) location.href = `/ed/${e.id_site}/${e.id}`;
|
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;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue