oc-server 0.0.2-beta.0 → 0.0.2-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Server.js +2 -1
- package/dist/serverClient.js +1 -10
- package/package.json +1 -1
package/dist/Server.js
CHANGED
|
@@ -16,7 +16,8 @@ class Server {
|
|
|
16
16
|
let res;
|
|
17
17
|
try {
|
|
18
18
|
if (actionName && this.actions[actionName]) {
|
|
19
|
-
|
|
19
|
+
const data = params?.data ?? params;
|
|
20
|
+
res = await this.actions[actionName](data, context);
|
|
20
21
|
}
|
|
21
22
|
else {
|
|
22
23
|
res = await this.initial(params, context);
|
package/dist/serverClient.js
CHANGED
|
@@ -18,21 +18,12 @@ function getAction(options) {
|
|
|
18
18
|
});
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
console.log('HELLO');
|
|
22
21
|
exports.serverClient = new Proxy({}, {
|
|
23
22
|
get(_target, prop) {
|
|
24
23
|
return (data) => {
|
|
25
24
|
const componentName = '';
|
|
26
25
|
const componentVersion = '';
|
|
27
|
-
|
|
28
|
-
.querySelector(`oc-component[data-name="${componentName}"][data-version="${componentVersion}"]`)
|
|
29
|
-
?.getAttribute('href');
|
|
30
|
-
if (!url?.startsWith('http')) {
|
|
31
|
-
url = `${window.location.protocol}${url}`;
|
|
32
|
-
}
|
|
33
|
-
const base = new URL(url);
|
|
34
|
-
const baseUrl = base.origin +
|
|
35
|
-
base.pathname.replace(new RegExp(`/${componentName}/[\\dx]\.[\\dx]\.[\\dx].*`), '');
|
|
26
|
+
const baseUrl = window.oc?.renderedComponents?.[componentName]?.baseUrl ?? '/';
|
|
36
27
|
return getAction({
|
|
37
28
|
action: prop,
|
|
38
29
|
baseUrl,
|