@veritree/services 1.5.0-1 → 1.5.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/index.js +3 -1
- package/package.json +1 -1
- package/src/endpoints/field-updates.js +2 -13
- package/src/endpoints/users.js +5 -0
- package/src/helpers/api.js +4 -4
package/index.js
CHANGED
|
@@ -19,6 +19,7 @@ import { SubsiteTypes } from './src/endpoints/subsite-types';
|
|
|
19
19
|
import { Tags } from './src/endpoints/tags';
|
|
20
20
|
import { TreeOrders } from './src/endpoints/trees-orders';
|
|
21
21
|
import { User } from './src/endpoints/user';
|
|
22
|
+
import { Users } from './src/endpoints/users';
|
|
22
23
|
|
|
23
24
|
export {
|
|
24
25
|
BulkUploads,
|
|
@@ -41,5 +42,6 @@ export {
|
|
|
41
42
|
SubsiteTypes,
|
|
42
43
|
Tags,
|
|
43
44
|
TreeOrders,
|
|
44
|
-
User
|
|
45
|
+
User,
|
|
46
|
+
Users
|
|
45
47
|
}
|
package/package.json
CHANGED
|
@@ -1,16 +1,5 @@
|
|
|
1
1
|
import Api from "../helpers/api";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
constructor(resource) {
|
|
5
|
-
super(resource);
|
|
6
|
-
this.resource = "field-updates";
|
|
7
|
-
}
|
|
3
|
+
const resource = "field-updates";
|
|
8
4
|
|
|
9
|
-
|
|
10
|
-
const url = `${this.getUrl()}/${fieldUpdateId}/images${this.getUrlParams(args)}`;
|
|
11
|
-
|
|
12
|
-
return await this.get(url);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const FieldUpdates = new FieldUpdatesApi();
|
|
5
|
+
export const FieldUpdates = new Api(resource);
|
package/src/helpers/api.js
CHANGED
|
@@ -8,13 +8,13 @@ import { getSession } from "./session";
|
|
|
8
8
|
* @param {string} url
|
|
9
9
|
* @returns {string} url
|
|
10
10
|
*/
|
|
11
|
-
function
|
|
11
|
+
function addEnvelopeParam(url) {
|
|
12
12
|
if (!url || url.includes("_result=1")) return url;
|
|
13
13
|
|
|
14
14
|
const urlHasArgs = url.includes("?");
|
|
15
|
-
const
|
|
15
|
+
const urlEvenlopeArg = urlHasArgs ? "&_result=1" : "?_result=1";
|
|
16
16
|
|
|
17
|
-
return `${url}${
|
|
17
|
+
return `${url}${urlEvenlopeArg}`;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
/**
|
|
@@ -183,7 +183,7 @@ export default class Api {
|
|
|
183
183
|
* @returns {object} envelope
|
|
184
184
|
*/
|
|
185
185
|
async unWrap(url, method = "get", data, as) {
|
|
186
|
-
url =
|
|
186
|
+
url = addEnvelopeParam(url);
|
|
187
187
|
const config = getConfig(method, data, as);
|
|
188
188
|
const response = await fetch(url, config);
|
|
189
189
|
|