This commit is contained in:
Rizky 2024-02-07 17:59:46 +07:00
parent dab31e6ab2
commit c140f98441
2 changed files with 31 additions and 26 deletions

View File

@ -69,10 +69,18 @@ export const fetchViaProxy = async (
(Array.isArray(data) && data[0] instanceof File) (Array.isArray(data) && data[0] instanceof File)
) { ) {
if (data instanceof File) { if (data instanceof File) {
const res = await fetch(url, { body: data, headers: _headers }); const res = await fetch(url, {
body: data,
method: "POST",
headers: _headers,
});
return await res.text(); return await res.text();
} else { } else {
const res = await fetch(url, { body: data[0], headers: _headers }); const res = await fetch(url, {
body: data[0],
method: "POST",
headers: _headers,
});
return await res.text(); return await res.text();
} }
} else { } else {

View File

@ -14,7 +14,6 @@ export const viLoadSnapshot = async (p: PG) => {
try { try {
const apiURL = new URL(api_url); const apiURL = new URL(api_url);
if (api_url && apiURL.hostname) { if (api_url && apiURL.hostname) {
try {
await loadApiProxyDef(api_url, true); await loadApiProxyDef(api_url, true);
const api = w.prasiApi[api_url]; const api = w.prasiApi[api_url];
@ -39,13 +38,11 @@ export const viLoadSnapshot = async (p: PG) => {
}); });
} }
} }
}
} catch (e) { } catch (e) {
console.warn("Failed to load API:", api_url); console.warn("Failed to load API:", api_url);
} }
}
} catch (e) {}
console.log(p.site.code);
if (p.site.code.snapshot) { if (p.site.code.snapshot) {
for (const [name, build] of Object.entries(p.site.code.snapshot)) { for (const [name, build] of Object.entries(p.site.code.snapshot)) {
const doc = new Y.Doc(); const doc = new Y.Doc();