@onehat/data 1.8.4 → 1.8.7

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": "@onehat/data",
3
- "version": "1.8.4",
3
+ "version": "1.8.7",
4
4
  "description": "JS data modeling package with adapters for many storage mediums.",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
package/src/Entity.js CHANGED
@@ -152,9 +152,11 @@ class Entity extends EventEmitter {
152
152
  },
153
153
  set (target, name, value, receiver) {
154
154
  if (!Reflect.has(target, name)) {
155
- return target.setValue(name, value);
155
+ target.setValue(name, value);
156
+ } else {
157
+ Reflect.set(target, name, value, receiver);
156
158
  }
157
- return Reflect.set(target, name, value, receiver);
159
+ return true; // Return true, or else we sometimes get a proxy trap type error. https://developer.mozilla.org/en-US/docs/web/javascript/reference/global_objects/proxy/proxy/set
158
160
  },
159
161
  });
160
162
 
@@ -163,7 +163,7 @@ class OneBuildRepository extends AjaxRepository {
163
163
  }
164
164
  });
165
165
 
166
- if (this.isLoaded) {
166
+ if (this.isLoaded && this.autoLoad) {
167
167
  return this.reload();
168
168
  }
169
169
  }
@@ -183,7 +183,7 @@ class OneBuildRepository extends AjaxRepository {
183
183
  this.setBaseParam('order', sorterStrings.join(','));
184
184
  }
185
185
 
186
- if (this.isLoaded) {
186
+ if (this.isLoaded && this.autoLoad) {
187
187
  return this.reload();
188
188
  }
189
189
  }
@@ -291,6 +291,36 @@ class OneBuildRepository extends AjaxRepository {
291
291
  });
292
292
  }
293
293
 
294
+ forgotPassword = (email = null, username = null) => {
295
+ const data = {
296
+ url: 'forgotPassword',
297
+ data: qs.stringify({
298
+ email,
299
+ username,
300
+ }),
301
+ method: 'POST',
302
+ baseURL: this.api.baseURL,
303
+ };
304
+
305
+ if (this.debugMode) {
306
+ console.log('forgotPassword', data);
307
+ }
308
+
309
+ return this.axios(data)
310
+ .then((result) => {
311
+ if (this.debugMode) {
312
+ console.log('forgotPassword result', result);
313
+ }
314
+
315
+ const response = result.data;
316
+ if (!response.success) {
317
+ throw new Error(response.data);
318
+ }
319
+
320
+ return response;
321
+ });
322
+ }
323
+
294
324
  }
295
325
 
296
326