From 825a3808560dbdcbb816028990145f2a958de5bd Mon Sep 17 00:00:00 2001 From: Rizky Date: Tue, 27 Feb 2024 07:22:04 +0700 Subject: [PATCH] wip fix --- pkgs/server/prep-api-ts.ts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/pkgs/server/prep-api-ts.ts b/pkgs/server/prep-api-ts.ts index 032c81f..c3ecf50 100644 --- a/pkgs/server/prep-api-ts.ts +++ b/pkgs/server/prep-api-ts.ts @@ -93,10 +93,6 @@ export const getContent = async ( } else if (type === "load.js.dev") { if (!g.api_gen[type]) g.api_gen[type] = `\ -(() => { - const baseurl = new URL(location.href); - baseurl.pathname = ''; - const url = ${url} || baseurl.toString(); const w = window; if (!w.prasiApi) { w.prasiApi = {}; @@ -114,10 +110,6 @@ export const getContent = async ( } else if (type === "load.js.prod") { if (!g.api_gen[type]) g.api_gen[type] = `\ -(() => { - const baseurl = new URL(location.href); - baseurl.pathname = ''; - const url = ${url} || baseurl.toString(); const w = window; if (!w.prasiApi) { w.prasiApi = {}; @@ -127,7 +119,12 @@ export const getContent = async ( } })();`; } - return g.api_gen[type]; + return `\ +(() => { + const baseurl = new URL(location.href); + baseurl.pathname = ''; + const url = ${url} || baseurl.toString(); +${g.api_gen[type]}`; }; const getApiTypes = async () => {