@cpzxrobot/sdk 1.3.51 → 1.3.53

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/device_filter.ts CHANGED
@@ -31,7 +31,7 @@ export abstract class DeviceFilter<T extends { id: number }> {
31
31
  }
32
32
 
33
33
  add(device: any) {
34
- this.context.ready.then(axios=>{
34
+ this.context.ready.then(axios => {
35
35
  return axios.post("/api/v2/device/add", device)
36
36
  })
37
37
  }
@@ -208,10 +208,11 @@ export abstract class DeviceFilter<T extends { id: number }> {
208
208
  if (args.type == "raw") {
209
209
  return res;
210
210
  } else {
211
- if (res.data.Error) {
211
+ if (!res.data) {
212
+ throw "device_list error(" + JSON.stringify(res) + ")";
213
+ } else if (res.data.Error) {
212
214
  throw res.data.Error;
213
215
  }
214
- // this.devices.push(res.data);
215
216
  return res.data;
216
217
  }
217
218
  });
@@ -384,7 +385,9 @@ export abstract class DeviceFilter<T extends { id: number }> {
384
385
  });
385
386
  })
386
387
  .then((res) => {
387
- if (res.data.Error) {
388
+ if (!res.data) {
389
+ throw "device_list error(" + JSON.stringify(res) + ")";
390
+ } else if (res.data.Error) {
388
391
  throw res.data.Error;
389
392
  } else {
390
393
  return this.wrapList(res.data);
@@ -189,10 +189,12 @@ class DeviceFilter {
189
189
  return res;
190
190
  }
191
191
  else {
192
- if (res.data.Error) {
192
+ if (!res.data) {
193
+ throw "device_list error(" + JSON.stringify(res) + ")";
194
+ }
195
+ else if (res.data.Error) {
193
196
  throw res.data.Error;
194
197
  }
195
- // this.devices.push(res.data);
196
198
  return res.data;
197
199
  }
198
200
  });
@@ -328,7 +330,10 @@ class DeviceFilter {
328
330
  });
329
331
  })
330
332
  .then((res) => {
331
- if (res.data.Error) {
333
+ if (!res.data) {
334
+ throw "device_list error(" + JSON.stringify(res) + ")";
335
+ }
336
+ else if (res.data.Error) {
332
337
  throw res.data.Error;
333
338
  }
334
339
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.3.51",
3
+ "version": "1.3.53",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {