@plusscommunities/pluss-core-aws 2.0.7 → 2.0.8
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/db/strings/getString.js +25 -0
- package/package.json +1 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const _ = require("lodash");
|
|
2
|
+
const getRef = require("../common/getRef");
|
|
3
|
+
|
|
4
|
+
module.exports = async (id, defaultSite) => {
|
|
5
|
+
return new Promise((resolve) => {
|
|
6
|
+
getRef("strings", "RowId", id)
|
|
7
|
+
.then((ev) => {
|
|
8
|
+
return resolve(ev.Value);
|
|
9
|
+
})
|
|
10
|
+
.catch(() => {
|
|
11
|
+
if (defaultSite) {
|
|
12
|
+
const defaultId = `${defaultSite}_${id.split("_")[1]}`;
|
|
13
|
+
getRef("strings", "RowId", defaultId)
|
|
14
|
+
.then((ev) => {
|
|
15
|
+
return resolve(ev.Value);
|
|
16
|
+
})
|
|
17
|
+
.catch(() => {
|
|
18
|
+
return resolve(null);
|
|
19
|
+
});
|
|
20
|
+
} else {
|
|
21
|
+
return resolve(null);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
};
|