@veritree/services 2.5.0 → 2.5.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.5.0",
3
+ "version": "2.5.3",
4
4
  "description": "A collection of javascript functions/services to talk to veritree API",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -6,11 +6,6 @@ class UserApi extends Api {
6
6
  this.resource = 'me';
7
7
  }
8
8
 
9
- async roles(id, data, params) {
10
- const url = `${this.getUrl()}/${id}/roles${this.getUrlParams(params)}`;
11
- return await this.update(url, data, 'patch');
12
- }
13
-
14
9
  async me() {
15
10
  const url = `${this.getUrl()}${this.getUrlParams()}`;
16
11
  return await this.get(url);
@@ -1,5 +1,15 @@
1
1
  import Api from '../helpers/api';
2
2
 
3
- const resource = 'users';
3
+ class UsersApi extends Api {
4
+ constructor(resource) {
5
+ super(resource);
6
+ this.resource = 'users';
7
+ }
4
8
 
5
- export const Users = new Api(resource);
9
+ async roles(id, data, params) {
10
+ const url = `${id}/roles${this.getUrlParams(params)}`;
11
+ return await this.update(url, data, 'put');
12
+ }
13
+ }
14
+
15
+ export const Users = new UsersApi();