Skip to content

Commit 73a9bd4

Browse files
committed
logs
1 parent d17445b commit 73a9bd4

File tree

3 files changed

+40
-3
lines changed

3 files changed

+40
-3
lines changed

composables/api_fetch.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@ export function api_fetch(
3232
if (schema.max_retry) {
3333
request_options.max_retry = schema.max_retry
3434
}
35+
if (process.env.NODE_ENV !== "production") {
36+
try {
37+
console.log("[api_fetch]", schema?.$id, request_options)
38+
if (schema?.$id === "opengeodeweb_back/export_project") {
39+
console.log("[api_fetch] export_project", { params: body })
40+
console.trace()
41+
}
42+
} catch {}
43+
}
3544
return useFetch(schema.$id, {
3645
baseURL: geode_store.base_url,
3746
...request_options,

composables/project_manager.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ export function useProjectManager() {
99
const geode = useGeodeStore()
1010
const infraStore = useInfraStore()
1111
const snapshot = appStore.exportStores()
12+
try {
13+
console.log("[export] snapshot keys", Object.keys(snapshot || {}))
14+
} catch {}
1215
const schema = back_schemas.opengeodeweb_back.export_project
1316
const defaultName = "project.vease"
1417

1518
await infraStore.create_connection()
16-
let downloaded = false
1719
const result = await api_fetch(
1820
{ schema, params: { snapshot, filename: defaultName } },
1921
{
2022
response_function: function (response) {
21-
if (downloaded) return
22-
downloaded = true
2323
const data = response._data
2424
const headerName =
2525
(response.headers &&

plugins/auto_store_register.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,32 @@ export default defineNuxtPlugin((nuxtApp) => {
1313
console.log(
1414
"[AUTOREGISTER PLUGIN] Loaded automatically from OpenGeodeWeb-Front",
1515
)
16+
if (typeof window !== "undefined") {
17+
const origFetch = window.fetch
18+
window.fetch = async (input, init) => {
19+
const url = typeof input === "string" ? input : (input && input.url) || ""
20+
if (url.includes("/opengeodeweb_back/export_project")) {
21+
const body = init && init.body
22+
let snapshotKeys = []
23+
let filename = undefined
24+
try {
25+
filename = body && body.filename
26+
if (body && typeof body === "object" && body.snapshot) {
27+
snapshotKeys = Object.keys(body.snapshot || {})
28+
}
29+
} catch {}
30+
console.log("[net] fetch export_project", { url, filename, snapshotKeys })
31+
console.trace()
32+
}
33+
return origFetch(input, init)
34+
}
35+
const origOpen = XMLHttpRequest.prototype.open
36+
XMLHttpRequest.prototype.open = function (method, url, ...args) {
37+
if (typeof url === "string" && url.includes("/opengeodeweb_back/export_project")) {
38+
console.log("[net] xhr export_project", { method, url })
39+
console.trace()
40+
}
41+
return origOpen.call(this, method, url, ...args)
42+
}
43+
}
1644
})

0 commit comments

Comments
 (0)