flamerest 1.0.99 → 1.0.101
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/REST.js +10 -0
- package/package.json +1 -1
package/REST.js
CHANGED
|
@@ -170,6 +170,8 @@ class FLAMEREST {
|
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
+
|
|
174
|
+
|
|
173
175
|
// Заполняем тело ответа заголовками
|
|
174
176
|
ResolveBody.type = "json";
|
|
175
177
|
ResolveBody.data = {};
|
|
@@ -532,6 +534,14 @@ class FLAMEREST {
|
|
|
532
534
|
// после успешной авторизации устанавливаем токен
|
|
533
535
|
if (typeof resp.token === 'string') this.token = resp.token;
|
|
534
536
|
|
|
537
|
+
// Сохраняем хеш юзера автоматически
|
|
538
|
+
let user_hash = localStorage.getItem('user_hash');
|
|
539
|
+
|
|
540
|
+
// Не трогаем хранилище при каждом запросе, только если нужно переустановить хеш [авторизация на др. устройстве]
|
|
541
|
+
if (resp?.data?.User?.user_hash && resp.data.User.user_hash !== user_hash) {
|
|
542
|
+
localStorage.setItem('user_hash', resp.data.User.user_hash);
|
|
543
|
+
}
|
|
544
|
+
|
|
535
545
|
return resp.data;
|
|
536
546
|
|
|
537
547
|
}
|