This commit is contained in:
Rizky 2024-03-01 15:57:27 +07:00
parent ea70a7f43b
commit 73ecc7b921
4 changed files with 27 additions and 9 deletions

File diff suppressed because one or more lines are too long

View File

@ -148,7 +148,6 @@ export const apiProxy = (api_url: string) => {
} }
); );
} catch (e) { } catch (e) {
console.warn("Init API failed for URL: ", JSON.stringify(api_url));
return null; return null;
} }
}; };
@ -158,4 +157,3 @@ const fetchSendApi = async (url: string, params: any) => {
"content-type": "application/json", "content-type": "application/json",
}); });
}; };

View File

@ -23,8 +23,10 @@ const start = async () => {
await loadApiProxyDef(base_url, false); await loadApiProxyDef(base_url, false);
w._api = apiProxy(base_url); w._api = apiProxy(base_url);
} catch (e) { } catch (e) {
if (cur.host) {
console.warn("Failed to load API:", base_url); console.warn("Failed to load API:", base_url);
} }
}
w.serverurl = base_url; w.serverurl = base_url;

View File

@ -91,8 +91,14 @@ export const edInitSync = (p: PG) => {
site: params.site_id site: params.site_id
? { id: params.site_id } ? { id: params.site_id }
: { : {
org: {
org_user: {
some: {
id_user: p.user.id, id_user: p.user.id,
}, },
},
},
},
name: { name: {
contains: "root", contains: "root",
mode: "insensitive", mode: "insensitive",
@ -114,8 +120,14 @@ export const edInitSync = (p: PG) => {
site: params.site_id site: params.site_id
? { id: params.site_id } ? { id: params.site_id }
: { : {
org: {
org_user: {
some: {
id_user: p.user.id, id_user: p.user.id,
}, },
},
},
},
name: { name: {
contains: "home", contains: "home",
mode: "insensitive", mode: "insensitive",
@ -133,9 +145,15 @@ export const edInitSync = (p: PG) => {
site: params.site_id site: params.site_id
? { id: params.site_id } ? { id: params.site_id }
: { : {
org: {
org_user: {
some: {
id_user: p.user.id, id_user: p.user.id,
}, },
}, },
},
},
},
select: { id: true, id_site: true }, select: { id: true, id_site: true },
}); });
if (e) location.href = `/ed/${e.id_site}/${e.id}`; if (e) location.href = `/ed/${e.id_site}/${e.id}`;