flamerest 1.0.100 → 1.0.102

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.
Files changed (2) hide show
  1. package/REST.js +5 -3
  2. package/package.json +1 -1
package/REST.js CHANGED
@@ -65,8 +65,10 @@ class FLAMEREST {
65
65
  request(url, params, type = 'GET', responseType = 'json', isNeedToken = true, customHeaders = {}) {
66
66
 
67
67
  // Нормализуем параметры, если они есть
68
- if (typeof params === "object") {
68
+ if (typeof params === "object" && params !== null) {
69
69
  params = JSON.stringify(params);
70
+ type = 'POST';
71
+ responseType = 'json';
70
72
  }
71
73
 
72
74
  let that = this;
@@ -538,8 +540,8 @@ class FLAMEREST {
538
540
  let user_hash = localStorage.getItem('user_hash');
539
541
 
540
542
  // Не трогаем хранилище при каждом запросе, только если нужно переустановить хеш [авторизация на др. устройстве]
541
- if (resp?.User?.user_hash && resp.User.user_hash !== user_hash) {
542
- localStorage.setItem('user_hash', resp.User.user_hash);
543
+ if (resp?.data?.User?.user_hash && resp.data.User.user_hash !== user_hash) {
544
+ localStorage.setItem('user_hash', resp.data.User.user_hash);
543
545
  }
544
546
 
545
547
  return resp.data;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flamerest",
3
- "version": "1.0.100",
3
+ "version": "1.0.102",
4
4
  "description": "",
5
5
  "main": "REST.js",
6
6
  "typings": "./REST.d.ts",