@resolveio/client-lib-core 1.1.28 → 1.1.29

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.
@@ -1104,6 +1104,9 @@ class SocketManagerService {
1104
1104
  this._connectionDelayTimeout = null;
1105
1105
  this.onerror = function () { };
1106
1106
  }
1107
+ getSubArray() {
1108
+ return this._subArray;
1109
+ }
1107
1110
  initSocketManager() {
1108
1111
  this._socket.readyState$.subscribe(socketStatus => {
1109
1112
  this.socketStatus = socketStatus;
@@ -1504,12 +1507,17 @@ class AccountManagerService {
1504
1507
  if (this.user$) {
1505
1508
  this.user$.unsubscribe();
1506
1509
  }
1507
- this.user$ = this._socket.subscribeBypassRoute('userLoggedIn', res.result.user._id).subscribe(resUser => {
1510
+ this.user$ = this._socket.subscribeBypassRoute('userWithId', res.result.user._id).subscribe(resUser => {
1508
1511
  if (resUser) {
1509
- this.user.next(resUser);
1510
- this.loginCompleted.next(true);
1511
- this.initCompleted.next(true);
1512
- this._offline.saveUser(resUser);
1512
+ if (this.user.getValue() && this.user.getValue()._id !== resUser._id) {
1513
+ this._socket.call('incorrectUser', this.user.getValue(), resUser, this._socket.getSubArray());
1514
+ }
1515
+ else {
1516
+ this.user.next(resUser);
1517
+ this.loginCompleted.next(true);
1518
+ this.initCompleted.next(true);
1519
+ this._offline.saveUser(resUser);
1520
+ }
1513
1521
  }
1514
1522
  });
1515
1523
  }