@veritree/services 2.18.1-2 → 2.18.1-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": "2.18.1-2",
3
+ "version": "2.18.1-3",
4
4
  "description": "A collection of javascript functions/services to talk to veritree API",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -1,10 +1,10 @@
1
- import Api from '../helpers/api';
2
- import { createParamsStringFromArgs } from '../utils/args';
1
+ import Api from "../helpers/api";
2
+ import { createParamsStringFromArgs } from "../utils/args";
3
3
 
4
4
  class SubsitesApi extends Api {
5
5
  constructor(resource) {
6
6
  super(resource);
7
- this.resource = 'subsites';
7
+ this.resource = "subsites";
8
8
  }
9
9
 
10
10
  locationsByOrg() {
@@ -33,7 +33,7 @@ class SubsitesApi extends Api {
33
33
 
34
34
  const remove = async (subsite, indicator) => {
35
35
  const url = `${this.getUrl()}/${subsite}/indicators/${indicator}`;
36
- return await this.post(url, null, 'delete');
36
+ return await this.post(url, null, "delete");
37
37
  };
38
38
 
39
39
  return {
@@ -54,16 +54,22 @@ class SubsitesApi extends Api {
54
54
  };
55
55
  }
56
56
 
57
- evidence(subsiteId) {
57
+ evidence(subsiteId, params) {
58
+ const url = `${this.getUrl()}/${subsiteId}/evidence${this.getUrlParams(
59
+ params
60
+ )}`;
61
+
58
62
  const all = async () => {
59
- const url = `${this.getUrl()}/${subsiteId}/evidence${this.getUrlParams(
60
- args
61
- )}`;
62
63
  return await this.get(url);
63
64
  };
64
65
 
66
+ const attach = async (formData) => {
67
+ return await this.post(url, formData);
68
+ };
69
+
65
70
  return {
66
71
  all,
72
+ attach,
67
73
  };
68
74
  }
69
75
  }
@@ -11,7 +11,7 @@ import { getSession } from './session';
11
11
  function addVersionArg(url) {
12
12
  if (!url || url.includes('_result=1')) return url;
13
13
 
14
- const version = process.env ? process.env.API_VERITREE_VERSION : null || '5.0.0';
14
+ const version = process.env ? process.env.API_VERITREE_VERSION ? process.env.API_VERITREE_VERSION : '5.0.0' : '5.0.0' || '5.0.0';
15
15
  const urlHasArgs = url.includes('?');
16
16
  const urlVersionArg = urlHasArgs ? `&_v=${version}` : `?_v=${version}`;
17
17