@veritree/services 2.0.1 → 2.1.0
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/package.json +1 -1
- package/src/helpers/api.js +15 -6
package/package.json
CHANGED
package/src/helpers/api.js
CHANGED
|
@@ -91,7 +91,6 @@ export default class Api {
|
|
|
91
91
|
* @returns {promise}
|
|
92
92
|
*/
|
|
93
93
|
async create(data, args) {
|
|
94
|
-
console.log(1);
|
|
95
94
|
return await this.post(null, data, null, args);
|
|
96
95
|
}
|
|
97
96
|
|
|
@@ -161,15 +160,25 @@ export default class Api {
|
|
|
161
160
|
getUrlParams(args) {
|
|
162
161
|
this.setOrg();
|
|
163
162
|
let isOrgLess = false;
|
|
164
|
-
let
|
|
165
|
-
let
|
|
163
|
+
let isOrgAs = false;
|
|
164
|
+
let orgIdParam = null;
|
|
165
|
+
let orgTypeParam = null;
|
|
166
166
|
|
|
167
167
|
// while most of endpoints require an org id and type, some endpoints do not
|
|
168
|
-
if (args
|
|
169
|
-
isOrgLess = Object.
|
|
168
|
+
if (args) {
|
|
169
|
+
isOrgLess = Object.hasOwn(args, "orgless");
|
|
170
|
+
isOrgAs = Object.hasOwn(args, "org_id_as") && Object.hasOwn(args, "org_type_as");
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// a super admin user can create/edit data from other orgs
|
|
174
|
+
// and for that, we can't use the org id and type in
|
|
175
|
+
// the session.
|
|
176
|
+
if(isOrgAs) {
|
|
177
|
+
orgIdParam = `org_id_as=${args.org_id_as}`;
|
|
178
|
+
orgTypeParam = `org_type_as=${args.org_type_as}`;
|
|
170
179
|
}
|
|
171
180
|
|
|
172
|
-
if (!isOrgLess) {
|
|
181
|
+
if (!isOrgLess && !isOrgAs) {
|
|
173
182
|
if (this.orgId) orgIdParam = `org_id=${this.orgId}`;
|
|
174
183
|
if (this.orgType) orgTypeParam = `&org_type=${this.orgType}`;
|
|
175
184
|
}
|