sr-npm 1.7.838 → 1.7.839
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/backend/http-functions.js +23 -0
- package/package.json +1 -1
- package/pages/index.js +1 -1
- package/pages/masterPage.js +12 -2
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const { getApiKeys } = require('./secretsData');
|
|
2
|
+
const { ok, badRequest } = require('wix-http-functions');
|
|
3
|
+
|
|
4
|
+
export async function get_getApiKeys(request) {
|
|
5
|
+
try {
|
|
6
|
+
const data = await getApiKeys();
|
|
7
|
+
return ok({
|
|
8
|
+
body: data,
|
|
9
|
+
headers: {
|
|
10
|
+
"Content-Type": "application/json"
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
} catch (error) {
|
|
14
|
+
console.error('Error in get_getApiKeys:', error);
|
|
15
|
+
return badRequest({
|
|
16
|
+
body: { error: error.message },
|
|
17
|
+
headers: {
|
|
18
|
+
"Content-Type": "application/json"
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
package/package.json
CHANGED
package/pages/index.js
CHANGED
package/pages/masterPage.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TEMPLATE_TYPE } from '../backend/collectionConsts';
|
|
2
|
+
|
|
3
|
+
async function getApiKeys() {
|
|
4
|
+
const response = await fetch('/_functions/getApiKeys');
|
|
5
|
+
if (!response.ok) {
|
|
6
|
+
throw new Error('Failed to fetch API keys');
|
|
7
|
+
}
|
|
8
|
+
return await response.json();
|
|
9
|
+
}
|
|
2
10
|
|
|
3
11
|
async function masterPageOnReady(_$w) {
|
|
4
12
|
const { companyId, templateType } = await getApiKeys();
|
|
@@ -12,4 +20,6 @@ async function masterPageOnReady(_$w) {
|
|
|
12
20
|
}
|
|
13
21
|
}
|
|
14
22
|
|
|
15
|
-
export {
|
|
23
|
+
export default {
|
|
24
|
+
masterPageOnReady,
|
|
25
|
+
};
|