This commit is contained in:
tiago.kayaya
2021-10-15 15:21:26 +01:00
parent 887c9c2186
commit fcd518e8a3
5 changed files with 70 additions and 101 deletions
+7 -2
View File
@@ -9,6 +9,7 @@ import { AuthConnstants } from '../config/auth-constants';
import { AlertController } from '@ionic/angular';
import { SessionStore } from '../store/session.service';
import { AESEncrypt } from '../services/aesencrypt.service';
import { CookieService } from 'ngx-cookie-service';
@Injectable({
providedIn: 'root'
@@ -27,6 +28,7 @@ export class AuthService {
private storageService:StorageService,
public alertController: AlertController,
private aesencrypt: AESEncrypt,
private cookieService: CookieService,
) {
this.headers = new HttpHeaders();
@@ -102,8 +104,11 @@ export class AuthService {
console.log('Login to Rocket chat OK');
this.ValidatedUserChat = responseChat;
localStorage.setItem('userChat', JSON.stringify(responseChat));
localStorage.setItem('Meteor.loginToken', JSON.stringify(responseChat['data'].authToken));
localStorage.setItem('Meteor.userId', JSON.stringify(responseChat['data'].userId));
localStorage.setItem('Meteor.loginToken', responseChat['data'].authToken);
localStorage.setItem('Meteor.userId',responseChat['data'].userId);
this.cookieService.set('rc_token', responseChat['data'].authToken);
this.cookieService.set('rc_uid', responseChat['data'].userId);
alert(this.cookieService.get('rc_uid'));
this.storageService.store(AuthConnstants.AUTH, responseChat);
return true;
}