import ComponentStateBinderHandler from './state';
+ import { HTTP_METHOD } from '@mirlo/services/requests';
+import ComponentStateBinderHandler from './state';
import {getService} from './app';
/**
@@ -291,11 +292,11 @@ base/component.mjs
const requests = getService('requests');
const prom_res = await Promise.all(
fetch_data_entries.map(([key, value]) =>
- requests.postJSON(value.endpoint, value.data).then(result => {
+ requests.queryJSON(value.endpoint, value.data, value.method ?? HTTP_METHOD.POST, value.cache_name).then(result => {
this.#netdata[key] = result;
Object.freeze(this.#netdata[key]);
return result;
- }),
+ })
),
);
return prom_res;
@@ -470,7 +471,10 @@ base/component.mjs
* @returns {HTMLElement}
*/
queryId(el_id) {
- return (this.#sdom || document).getElementById(el_id);
+ if (this.mirlo._is_unsafe) {
+ return document.getElementById(el_id);
+ }
+ return this.root.getElementById(el_id);
}
}
@@ -489,7 +493,7 @@ base/component.mjs
diff --git a/docs/base_service.mjs.html b/docs/base_service.mjs.html
index 334eb16..d107c49 100644
--- a/docs/base_service.mjs.html
+++ b/docs/base_service.mjs.html
@@ -78,7 +78,7 @@ base/service.mjs
diff --git a/docs/base_state.mjs.html b/docs/base_state.mjs.html
index 2c4c496..a3b2c58 100644
--- a/docs/base_state.mjs.html
+++ b/docs/base_state.mjs.html
@@ -81,7 +81,7 @@ base/state.mjs
diff --git a/docs/index.html b/docs/index.html
index 35e118a..570dc5d 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -44,7 +44,7 @@ Home
Classes