@veritree/services 0.10.2 → 0.10.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veritree/services",
3
- "version": "0.10.2",
3
+ "version": "0.10.3",
4
4
  "description": "A collection of javascript functions/services to talk to veritree API",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -31,6 +31,17 @@ export const createFieldUpdatesApiService = () => {
31
31
  }
32
32
  };
33
33
 
34
+ /**
35
+ *
36
+ * @param {object} data
37
+ * @returns
38
+ */
39
+ const post = (data) => {
40
+ const url = `${_getUrl()}?${_getParams()}`;
41
+
42
+ return Api.post(url, data);
43
+ };
44
+
34
45
  /**
35
46
  *
36
47
  * @param {string} fieldUpdateId
@@ -49,7 +60,7 @@ export const createFieldUpdatesApiService = () => {
49
60
  const remove = {
50
61
  async img(fieldUpdateId, data) {
51
62
  const url = `${_getUrl()}/${fieldUpdateId}/images/detach?${_getParams()}`;
52
-
63
+
53
64
  return await Api.post(url, data);
54
65
  }
55
66
  }
@@ -72,6 +83,7 @@ export const createFieldUpdatesApiService = () => {
72
83
 
73
84
  return {
74
85
  get,
86
+ post,
75
87
  update,
76
88
  remove
77
89
  };
@@ -1,8 +1,13 @@
1
1
  import Api from "../helpers/api";
2
+ import { getSession } from "../helpers/session";
2
3
 
3
- export const createImagesApiService = (orgId, orgType) => {
4
- if (!orgId && !orgType) throw new Error("orgId and orgType are required");
4
+ export const createImagesApiService = () => {
5
5
  const resource = "images";
6
+ const { orgId, orgType } = getSession();
7
+
8
+ if (!orgId && !orgType) {
9
+ throw new Error('Organization id and type are required');
10
+ }
6
11
 
7
12
  const get = {
8
13
  async all(